Forum Discussion

MarieDR's avatar
MarieDR
Copper Contributor
Sep 27, 2019

nested if statement

I wrote the below nested if formula, but I'm getting no results.  Could someone please take a look at it and tell me what I've done wrong or what's missing?  

 

 

'= if(O2<19,239,"A",if(O2>19,240, "B",if(O2> 24,440, "C",if(O2>30,680, "D",if(O2>39,000, "E",if(O2>49,920, "F",if(O2>62,920, "G",if(O2>80,080, "H",if(O2>101,920, "I",if(O2>128960, "J",if(O2>163,800, "K",if(O2>208,000, "L"))))))))))))

6 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    MarieDR 

    Perhaps you mean

    =
    if(O2<19,239,"A",
    if(O2<24,440,"B",
    if(O2<30,680,"C",
    if(O2<39,000,"D",
    if(O2<49,920,"E",
    if(O2<62,920,"F",
    if(O2<80,080,"G",
    if(O2<101,920,"H",
    if(O2<128,960,"I",
    if(O2<163,800,"J",
    if(O2<208,000,"K","L"
    ))))))))))))

     

    • MarieDR's avatar
      MarieDR
      Copper Contributor

      SergeiBaklan  - No, that changed the formula completely.  The results I require must come from the  greater than number. 

       

      Thank  you, 

      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        MarieDR 

        And alternatively you may use formula like

        =LOOKUP(O2,
           {-1000,19239,24440,30680,39000,49920,62920,80080,101920,128960,163800,208000},
           {"A","B","C","D","E","F","G","H","I","J","K","L"}
        )

        Of course, it's better not to hardcode constants but put in some ranges.

Resources