Level 2LogicReading, 4 min

IF, IFS and nested logic

IF lets a sheet make a decision: =IF(condition, value if true, value if false). The condition is any comparison: C2>=B2, A2="West", D2<>"" (not blank).

Real rules usually have more than one test. Two helpers combine them:

  • AND(test1, test2) is true only when every test passes. Score of 70+ and 50+ employees.
  • OR(test1, test2) is true when any test passes. Region is West or the deal is over $20,000.

Put them inside IF: =IF(AND(B2>=70, C2>=50), "Qualified", "Nurture").

When there are more than two outcomes, like commission tiers, you'll see nested IFs in old sheets: an IF inside the false part of another IF, three or four deep. They work, but nobody can read them. IFS lists the tests in order and returns the value for the first one that's true:

=IFS(B2>=1.2, 10%, B2>=1, 8%, B2>=0.8, 5%, TRUE, 0)

Two rules make IFS behave. Order the tests from strictest to loosest, because it stops at the first match. And end with TRUE as a catch-all, or anything that matches nothing returns #N/A.

Finally, IFERROR. Some errors are expected: dividing by zero leads, looking up a code that doesn't exist. =IFERROR(B2/C2, "No leads") shows your fallback instead of #DIV/0!. Use it for errors you expect, not to hide ones you don't.