
A nested IF formula in Excel puts one IF function inside another so a single cell can choose between more than two results. It is how you turn a score into a grade or a sales figure into a bonus level. This guide explains how nesting works with made-up examples, shows the order rules that make it work, introduces the IFS function as a cleaner option and lists the mistakes that cause wrong answers.
A quick reminder of IF
=IF(logical_test, value_if_true, value_if_false)
A plain IF gives two outcomes. For example =IF(B2>=50, "Pass", "Fail") returns Pass for 50 or more and Fail for anything else. If you also need AND or OR inside the test, read the IF formula with AND and OR.

How nested IF works
The value_if_false part can hold another IF. Excel checks the first test, and only if it is false does it go on to the next one:
=IF(B2>=90, "A", IF(B2>=80, "B", IF(B2>=70, "C", "D")))
With a score of 85 the first test fails, the second passes, and the cell shows B. With 65 every test fails and the last value, D, is returned.
Order matters
Excel stops at the first true test. So list the tests from the highest threshold to the lowest, or from the lowest to the highest, but never mix them. If you put B2>=70 first, a score of 95 would return C because it already passed the first test.

Count the brackets
Each IF opens one bracket, and all of them close at the end. Three IF functions need three closing brackets. A missing bracket is the most common error in nested formulas. Excel colors matching bracket pairs when you edit, which helps.

Example: sales bonus levels
Suppose sales are in B2. Under 5,000 gives no bonus, 5,000 to 9,999 gives 3 percent, and 10,000 or more gives 5 percent:
=IF(B2>=10000, B2*0.05, IF(B2>=5000, B2*0.03, 0))
The rates here are made up for the example.
Nested IF with text
You can test text too. Put the text in quotes:
=IF(A2="Paid", "Done", IF(A2="Pending", "Follow up", "Check"))
Text tests are not case sensitive, so "paid" matches "Paid".

A cleaner way: the IFS function
IFS tests conditions in order and returns the value for the first true one, without nesting:
=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", TRUE, "D")
The final pair TRUE, "D" works as the else case. IFS is available in Excel for Microsoft 365 and in Excel 2019 and later. It is not in Excel 2016 or older, so check your version before sharing the file.
Another option: a lookup table
When you have many levels, a table is easier to maintain than a long formula. List the lower limits and the labels in two columns, and use an approximate match. Our guide to the XLOOKUP function shows the match mode that does this.
How many IFs can you nest?
Current versions of Excel allow up to 64 nested IF functions. That does not mean you should use that many. After three or four levels, the formula is hard to read and to fix. Use IFS or a lookup table instead.
Common mistakes
- Tests in the wrong order. The first true test wins.
- Missing closing brackets. Count them.
- Quotes around numbers.
"50"is text, not a number. - Blank cells. A blank cell counts as zero and may return the lowest grade. Test for blanks first with
IF(B2="", "", ...). - Numbers stored as text. The test may fail even when the value looks right.
Questions and answers
Can I use a nested IF in Google Sheets?
Yes. The syntax is the same, and Google Sheets also has IFS. See IF with multiple conditions in Google Sheets.
What is the difference between nested IF and IF with AND?
AND tests several conditions together to get one result. Nested IF chooses between several different results.
Why does my formula return FALSE?
You left out the value_if_false argument of the last IF. Add a final value.
Can I hide errors in the result?
Yes, but understand the cause first. See the IFERROR function.
Summary
Put each next IF in the false branch, order the tests from one end to the other, count your brackets and switch to IFS or a lookup table once the formula grows past three or four levels.
