Logical
Nested IF Statements in Excel (Step-by-Step Guide)
A nested IF places one IF inside another so a single formula can choose between three or more outcomes. Each IF handles one test, and its "false" slot holds the next IF in the chain.
Nested IFs are powerful but get hard to read fast. This guide shows how to build them correctly, in the right order, and when the newer IFS and SWITCH functions are a cleaner replacement.
Nested IF syntax
=IF(test1, result1, IF(test2, result2, IF(test3, result3, result_else))) | Argument | Required | What it does |
|---|---|---|
test1 | Required | The first condition. If TRUE, result1 is returned and the rest is skipped. |
result1 | Required | What to return when test1 is TRUE. |
value_if_false | Required | The third slot of each IF holds the NEXT IF, chaining the tests together. |
result_else | Required | The final innermost false value: the catch-all returned when no test passed. |
Note: Excel allows up to 64 nested IFs, but 2-3 is the practical limit for readability. Beyond that, use IFS or SWITCH. Works the same in Google Sheets.
Examples
Real, copy-paste-ready formulas.
1. Letter grade from a score
=IF(B2>=90,"A", IF(B2>=80,"B", IF(B2>=70,"C","F"))) Each IF tests one threshold; if it fails, control passes to the next IF in the false slot. The final "F" is the else for anything below 70.
2. Why order matters
=IF(B2>=30,"Hot", IF(B2>=20,"Warm","Cold")) List thresholds from highest to lowest. If you tested 20 first, a value of 35 would wrongly stop at "Warm".
3. Nested IF with AND
=IF(AND(B2>=60, C2="EU"), "Approve", IF(B2>=60, "Review", "Decline")) You can put AND or OR inside any test. A score of 65 outside the EU fails the first test but passes the second, returning "Review".
4. The cleaner alternative
=IFS(B2>=90,"A", B2>=80,"B", B2>=70,"C", TRUE,"F") IFS lists the same logic as flat condition/result pairs, with TRUE as the catch-all. It is far easier to read and edit than three nested IFs.
How to write Nested IF step by step
- 1
Write down your outcomes in order, from the highest or most specific threshold to the lowest.
- 2
Start the first test: =IF(B2>=90,"A",
- 3
In place of the false value, begin the next IF: IF(B2>=80,"B",
- 4
Continue nesting one IF per remaining band, each in the previous IF's false slot.
- 5
In the last IF, put the catch-all else value.
- 6
Close one bracket ) for every IF you opened, then press Enter.
Common errors and fixes
| Error | Why it happens | How to fix it |
|---|---|---|
Too many / too few brackets | The number of closing brackets does not match the number of IFs you opened. | Count your IFs and add exactly that many closing brackets at the end. Excel highlights matching pairs as you type. |
Wrong band returned | Tests are in the wrong order, so a value matched a broader test first. | Order tests from highest threshold to lowest (or most specific to least). |
You've entered too many arguments | A comma is misplaced, so an IF has more than its three parts. | Each IF must have exactly test, value-if-true, value-if-false. Check your commas. |
Result is always the else value | No test ever evaluates TRUE, often a wrong cell reference or a number stored as text. | Test each condition on its own, and confirm numbers are not stored as text. |
Frequently asked questions
How many IFs can you nest in Excel?
Excel supports up to 64 nested IFs, but anything past 2-3 becomes very hard to read and debug. For more outcomes, use IFS or SWITCH instead.
What is the correct order for nested IFs?
Test from the highest threshold (or most specific case) down to the lowest. IF returns on the first TRUE test, so a broader test placed too early will catch values meant for a later one.
How do I add multiple conditions inside a nested IF?
Use AND or OR inside any test, e.g. IF(AND(B2>=60, C2="EU"), ...). This keeps the nesting shallow while still checking several conditions per branch.
Should I use nested IF or IFS?
IFS is cleaner for several conditions because it lists them as flat pairs with no stacked brackets. Use nested IF when you need older Excel versions (2016 or earlier) that lack IFS, or for just one or two branches.