The IF function returns one result if a test is true and another if it is false. AND and OR let you test more than one thing at once.
Basic IF
=IF(B2>=40, "Pass", "Fail")
IF with AND
AND is true only when all conditions are true. Bonus only if sales are above 50,000 and rating is at least 4:
=IF(AND(B2>50000, C2>=4), "Bonus", "No bonus")
IF with OR
OR is true when any condition is true. Free delivery if the order is large or the customer is a member:
=IF(OR(B2>=1000, C2="Member"), "Free", "Paid")
Nested IF
To test several outcomes, place an IF inside another:
=IF(B2>=85, "A", IF(B2>=70, "B", IF(B2>=55, "C", "D")))
Each IF needs its own closing bracket. Count them at the end.
A cleaner option: IFS
=IFS(B2>=85, "A", B2>=70, "B", B2>=55, "C", TRUE, "D")
IFS reads top to bottom and avoids the pile of brackets. Put TRUE last as the catch-all.
Tips
- Put text results in quotes.
- Order matters in nested IFs. Test the highest band first.
- Use
NOTto flip a condition when it makes the formula simpler.