Forum Discussion

RyanStanford1's avatar
RyanStanford1
Qrew Captain
7 years ago

Formula Field variables set in an if statement

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.
  • 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])
    • RyanStanford1's avatar
      RyanStanford1
      Qrew Captain
      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.
  • 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.