Forum Discussion

MITVal23's avatar
MITVal23
Copper Contributor
Nov 14, 2022

IF function and Structured references need syntax help

I have spent hours trying to figure this formula out, and I am so tired and ready for this to end. I need help trying to set up syntax. To enter a formula using the IF function and structured references that test whether the value in the "tier" field is equal to "platinum," if it is, multiply the value in the "total sales" field by 0.05. Otherwise, enter 0 in the cell. 

 

Please please, pretty please help

  • mathetes's avatar
    mathetes
    Silver Contributor

    MITVal23 

     

    It would help give you a specific formula if you were to show us the actual layout of your data. Absent that, only a general idea of the IF formula can be supplied.

     

    So, assuming "tier" is in cell C2 and "total sales" is D2, then this formula could go in E2 (or wherever you want it to be). 

    =IF(C2="platinum",D2*.05,0)

    • PeterBartholomew1's avatar
      PeterBartholomew1
      Silver Contributor

      mathetes 

      Where did the structured references go?  Why not

      = IF([@tier]="platinum", [@sales]*5%, 0)

      But then, I am the only person on this forum that refers to the A1 notation as an abomination that has no place in any computational environment!

      • mathetes's avatar
        mathetes
        Silver Contributor

        PeterBartholomew1 

         

        Come to think of it, we also advocate against hard-coding values in a formula. So why wouldn't

        = IF([@tier]="platinum", [@sales]*5%, 0)

         become something like

        = IF([@tier]="platinum", [@sales]*PctMult, 0)

          referring to a named range off to the side?

    • MITVal23's avatar
      MITVal23
      Copper Contributor

      Thank you so much!mathetes 

      It worked, and I am thankful because I was ready to pull my hair out. LOL

Resources