• WSpapayasoft

    WSpapayasoft

    @wspapayasoft

    Viewing 1 replies (of 1 total)
    Author
    Replies
    • in reply to: Nested IF, AND, OR (2003) #1151604

      I build such a formula in steps, not all at once.

      First step: the IF function

      =IF(…,”OK”,”Error”)

      Second step: there are two main situations, so the … are replaced with an OR function:

      =IF(OR(…,…),”OK”,”Error”)

      Both … involve 2 conditions that should be satisfied, so they are replaced with AND functions:

      =IF(OR(AND(…,…),AND(…,…)),”OK”,”Error”)

      My first post in the Lounge.

      I was looking for an answer to how to do these complex conditions using Excel’s IF function. I was doing what I thought was the obvious thing:

      =IF (condition1 AND condition2, “It’s true”, “It’s false”)

      and kept getting a syntax error. I eventually became convinced (incorrectly) that the IF function supports only simple conditions and that even to do simply things, I had to do ridiculous workarounds using nested IF’s:

      =IF(X>0, IF (Y>0, “It’s true!”, “It’s false”), “It’s false”)

      Your post made it clear to me that AND and OR in Excel are *functions* rather than *operators*. Bing!

      Thanks so much for the excellent answer to the OP question.

      Now I see why everyone loves the Lounge so much. 😉

      Cheers!

    Viewing 1 replies (of 1 total)