The Excel IF Formula, Explained: Nested IF, IFS, AND & OR
Use =IF(test, value_if_true, value_if_false) for one condition. For several, either nest IFs or use the cleaner =IFS(test1, result1, test2, result2, TRUE, default). Combine conditions with AND(...) for 'all true' and OR(...) for 'any true'.
The IF function is the decision-maker of the spreadsheet world: “if this is true, do this; otherwise, do that.” Master it — plus its cleaner cousin IFS and the AND/OR helpers — and you can express almost any business rule.
=IF(test, value_if_true, value_if_false) for one condition; IFS(...) for many; AND(...)/OR(...) to combine conditions. Build any of these with our IF formula builder.The basic IF
Three arguments: the test, the result if true, the result if false.
=IF(A1>=60, "Pass", "Fail")
Text results go in quotes; numbers and cell references don’t. You can return a calculation, too, e.g. =IF(A1>100, A1*0.9, A1).
Nested IF for multiple outcomes
Chain IFs by placing another IF in the “false” slot:
=IF(A1>=90,"A",IF(A1>=80,"B",IF(A1>=70,"C","F")))
Order matters — the formula stops at the first true test, so list conditions from most to least restrictive. Excel allows up to 64 nested IFs, but past three or four it becomes hard to read and easy to mis-parenthesize.
IFS: the readable alternative
IFS lists condition/result pairs flatly. End with TRUE as the catch-all:
=IFS(A1>=90,"A", A1>=80,"B", A1>=70,"C", TRUE,"F")
IFS is available in Excel 2019+/365 and Google Sheets. For older Excel, stick with nested IF.
Combining conditions with AND and OR
- AND — all conditions must be true:
=IF(AND(A1>=60, B1="Yes"), "Approve", "Reject") - OR — any condition true:
=IF(OR(A1="VIP", B1>1000), "Priority", "Standard")
Handle errors and blanks
Wrap risky formulas in IFERROR to replace ugly errors: =IFERROR(A1/B1, 0). Test for empty cells with =IF(A1="", "Missing", A1).
When to stop nesting
If you’re mapping many inputs to many outputs (say, region → tax rate), a lookup table with VLOOKUP or XLOOKUP is cleaner and easier to maintain than a long IF chain. And to skip the syntax entirely, let AI write the formula.