Nested IF
IF(test1, result1, IF(test2, result2, result3))
The outer IF handles the first test. Its false branch is another IF. The innermost value is the final else. Test the highest cutoff first when the bands are 'at least N'.
A nested IF puts another IF in the true branch or the false branch so one formula can return more than two results. For letter grades, test the highest cutoff first: 90 and above is A, otherwise test 80, otherwise C. IFS does the same job as a list of pairs in Excel 2019 and later and in Google Sheets. Nested IF remains the formula that also runs in older Excel.
IF(test1, result1, IF(test2, result2, result3))
The outer IF handles the first test. Its false branch is another IF. The innermost value is the final else. Test the highest cutoff first when the bands are 'at least N'.
IFS(test1, result1, test2, result2, TRUE, default)
Pairs are checked from left to right and the first true test wins. IFS has no separate else. A final TRUE, default pair is the usual fallback. If nothing matches and you omit that pair, IFS returns #N/A.
| Question | Nested IF | IFS |
|---|---|---|
| Shape | IF inside IF | A flat list of tests and results |
| Final else | The last argument of the innermost IF | A pair whose test is TRUE, if you add one |
| Nothing matched and there is no else | You always have an else if you closed the formula | #N/A |
| Order of tests | Highest cutoff first for 'at least' bands | Same. First true pair wins |
| Older Excel | Works | Excel 2019 or later, or Microsoft 365. Also Google Sheets |
90 and above is A. 80 and above is B. Anything else is C. 91, 82, and 64 are the three scores. Both formulas return the same letters when the tests are in that order.
| Row | A | B |
|---|---|---|
| 1 | Score | Region |
| 2 | 82 | East |
| 3 | 64 | West |
| 4 | 91 | East |
| 5 | 49 | North |
=IF(A2>=90,"A",IF(A2>=80,"B","C")) → B=IF(A3>=90,"A",IF(A3>=80,"B","C")) → C=IF(A4>=90,"A",IF(A4>=80,"B","C")) → A=IFS(A2>=90,"A",A2>=80,"B",TRUE,"C") → B=IFS(A4>=90,"A",A4>=80,"B",TRUE,"C") → A82 fails the 90 test and passes the 80 test, so it is a B. 64 fails both cutoffs and lands on C. 91 passes the first test and is an A. The nested IF's innermost "C" is the else. IFS uses TRUE as that else. If you tested >=80 before >=90, an A score would become a B, because 91 is also at least 80 and the first true test would win.
Letter grades and shipping tiers with a couple of cutoffs are readable if you test the top band first and indent the formula in your head as you count parentheses. The grade drill practices this.
Each extra band in a nested IF adds another IF and another closing parenthesis. IFS keeps one pair per band. Use it in Excel 2019 or later, Microsoft 365, and Google Sheets.
A region, a status, and a score that combine into one bonus are AND and OR inside a single IF, not three layers of IF. Nesting is for different results, not for extra requirements on one result.
IF(A2>=80, "B", IF(A2>=90, "A", "C")) labels 91 as B, because 91 meets the first test and the A test never runs. High cutoff first.
Each IF opens one parenthesis. The formula needs the same number of closing parentheses as opening ones. Excel colors them while you edit. If the formula will not enter, count again.
The last value of the innermost IF is not tested. If you needed another cutoff, that value has to be an IF, not a bare letter that you hoped would mean 'else if'.
IF(A2>=70, IF(B2="East", "Bonus", "No"), "No") works, but AND is the sentence you meant and it is easier to read. Save nesting for different outputs.
Nested IF works in every Excel version and in Google Sheets. Very old Excel limited how deep the nesting could go. Two or three levels, as in the grade example, are safe everywhere.
IFS requires Excel 2019, Excel 2021, Excel 2024, Microsoft 365, or Google Sheets. In Excel 2016 it returns #NAME?.
The comparison page for IFS and nested IF uses a shipping tier so you can see the TRUE fallback next to the innermost else.
Free drills are open with no account. Premium drills show the problem to everyone and grade the sheet for subscribers.
Modern Excel allows a deep nest, and you should stop long before that limit. Three bands are comfortable. Beyond that, IFS or a lookup table is easier to change when a cutoff moves.
Text results are quoted, including the final else: "C". Numbers are not quoted. A quoted number is text and will not sum later.
Yes. Nesting in the true branch is how you split a group that already passed the outer test. For ordered cutoffs, nesting in the false branch, as in the grade example, is the usual shape.
They should not. 'At least 80' includes 'at least 90'. The order of tests is what makes them exclusive. A lookup table of the minimum score for each grade is the other way to express the same bands, with VLOOKUP approximate match.