IF, AND, OR: Building Decision Logic

Make your spreadsheet think for you. Nest conditions to handle any business scenario.

The IF Formula

IF checks whether something is true or false, and returns a different value for each case. The three parts: the logical test, the value if true, the value if false.

Excel formula

=IF(logical_test, value_if_true, value_if_false)

-- Example: Flag sales reps who hit their quota
=IF(B2>=10000, "Hit Quota", "Below Target")

Nesting IFs for Multiple Conditions

You can put an IF inside another IF to handle more than two outcomes. This is called nesting. Keep it to 2-3 levels max — beyond that, use IFS() instead.

Excel formula

-- Three performance tiers
=IF(B2>=15000, "Exceeds", IF(B2>=10000, "Meets", "Below"))

-- Cleaner with IFS():
=IFS(B2>=15000, "Exceeds", B2>=10000, "Meets", TRUE, "Below")

AND and OR: Combining Conditions

AND returns TRUE only if ALL conditions are met. OR returns TRUE if ANY condition is met. Use them inside IF to test multiple things at once.

Excel formula

-- AND: Rep hit quota AND is in Q4
=IF(AND(B2>=10000, C2="Q4"), "Bonus Eligible", "Not Eligible")

-- OR: Product is either discontinued OR out of stock
=IF(OR(D2="Discontinued", E2=0), "Remove from Catalog", "Keep")

All courses