Formula Field variables set in an if statement

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
I am trying to assign a variable value in a formula field... but with the catch that the criteria is if a number is greater than 0... Example:

If([Branch - H&W Deferred Rate]>0,

var number Rate = [Branch - H&W Deferred Rate];,

var number Rate = [Branch - H&W Cash Rate];)

I've attempted the Case Switch... but that didn't work the way I need it to.
Photo of Ryan Stanford

Ryan Stanford

  • 1,408 Points 1k badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,894 Points 50k badge 2x thumb
Formula variables are great but in this case they are not necessary

If([Branch - H&W Deferred Rate]>0,

[Branch - H&W Deferred Rate], [Branch - H&W Cash Rate])
Photo of Ryan Stanford

Ryan Stanford

  • 1,408 Points 1k badge 2x thumb
Normally you would be accurate... but I'm setting the variable, as depending on the criteria, determines which values I need for calculations in this formula.
Photo of Ryan Stanford

Ryan Stanford

  • 1,408 Points 1k badge 2x thumb
I was able to figure out the solution... Please see below:

var Number Rate = If([Branch - H&W Deferred Rate]>0, [Branch - H&W Deferred Rate],[Branch - H&W Cash Rate]);


This was part of a huge calculation field, hence why I wanted the use the variable here.