Forum Discussion

NathanB2's avatar
NathanB2
Copper Contributor
Feb 05, 2023
Solved

Excel if functions with condition 1, condition 2, condition 3, and condition blank

Hi there.  This is my first time to post here.

 

I have limited Excel knowledge.  I know how to use an IF formula to do something like "if cell D2 = X, then do this; otherwise do something else."

 

But what I want to do is this:

 

  • if cell d2 ="X", then "blah, blah", or if d2 = "Y", then "blah, blah blah", or if d2 = anything else, then "blah", but if cell d2 is blank, then do nothing

Please help; thank you very much.

  • You have typed space in this formula IF(D2=" "," ","none of the above"), remove that space, try- =IF(D2="","","none of the above")
  • Harun24HR's avatar
    Harun24HR
    Bronze Contributor

    NathanB2 You need nested IF() functions.

    =IF(D2="X","X Blah",IF(D2="Y","Y Blah",IF(D2="","","Something Else")))

     

    • NathanB2's avatar
      NathanB2
      Copper Contributor

      Harun24HR 

      Thank you very much for your help.  Except for the blank bit, it worked for me.  This is what I typed into Excel:

       

      =IF(D2="a","a hi",IF(D2="b","b hi",IF(D2=" "," ","none of the above")))

       

      Unfortunately, if d2 is blank, then it still says "none of the above."  What I want in that case is for it to return nothing at all. 

       

      Do you have any suggestions for how to fix that?

      • Harun24HR's avatar
        Harun24HR
        Bronze Contributor
        You have typed space in this formula IF(D2=" "," ","none of the above"), remove that space, try- =IF(D2="","","none of the above")

Resources