Nested IF Formula

“nested if formula” comes up constantly, so this page leads with the exact answer, and only then explains the detail. Everything works in Excel on Windows and Mac and maps almost one-to-one to Google Sheets. Copy the answer above and get back to work, or read on to turn a one-off fix into something you never have to look up again.

Exact answer

In Excel: use nested IF functions to test multiple conditions in sequence — =IF(A1>90,"A",IF(A1>80,"B",IF(A1>70,"C","F"))) returns a grade based on score thresholds; Excel allows up to 64 levels of nesting, but IFS() is cleaner for more than 3 conditions.

Formula: Nested IF Formula

=IF(A1>90,"A",IF(A1>80,"B",IF(A1>70,"C","F")))
Annotated stepsExcel
1

Click the output cell (e.g. B1).

2

Type =IF( and enter the first condition (e.g. A1>90), a comma, the true value (e.g. "A"), and a comma.

3

Open the second IF immediately as the false value: =IF(A1>90,"A",IF(A1>80,"B",

4

Continue nesting: each additional condition adds another IF inside the previous false argument.

5

Close all parentheses — one ) per IF function used.

6

Press Enter. Copy the formula down the column.

7

For 4+ conditions, consider =IFS(condition1,result1,condition2,result2,…,TRUE,default) for readability.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

A nested IF formula places one IF function inside another so that Excel tests multiple conditions in sequence, returning a different result for each branch. The outer IF tests the first condition; if it is false, Excel falls through to the next IF inside the value_if_false argument. This chaining continues until a condition matches or the final else value is returned. Nested IFs are the classic Excel technique for tiered logic — grading scales, commission tiers, discount brackets — and have been available since the earliest Excel versions. In Excel 365 and 2019+, the IFS() function provides a cleaner alternative that lists condition-result pairs without deep nesting, but the nested IF pattern is portable to every Excel version and to Google Sheets unchanged. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “nested if formula”. Start on a copy or a tiny sample, keep the affected formula visible, and compare the result with the tool above before you touch the real workbook. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. The point is a workflow that saves repeating the same clicks every week, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

Scenario: column A contains exam scores (0–100) and you want column B to show a letter grade — A for scores above 90, B for above 80, C for above 70, and F otherwise. Enter =IF(A1>90,"A",IF(A1>80,"B",IF(A1>70,"C","F"))) in B1 and copy down. Excel tests the conditions from left to right: if A1 is 95 the first IF fires immediately and returns "A"; if A1 is 83, the first test fails, the second succeeds and returns "B"; if A1 is 72 only the third succeeds. For more than 3–4 tiers, replace with =IFS(A1>90,"A",A1>80,"B",A1>70,"C",TRUE,"F") which is easier to read and extend. Reach for a nested IF when you need a tiered decision tree inside a cell without helper columns or lookup tables. It is the most portable multi-condition formula in Excel — every version supports it, every colleague can read it, and it carries over to Google Sheets unchanged. Keep it to 3–4 levels for maintainability. A practical tip before you scale it up: build it once on a small block of test data, confirm the number against the tool on this page, and only then point it at your real sheet. That one habit catches almost every mistake while it is still cheap to fix, long before a wrong figure reaches a report or a colleague.

In Google Sheets

Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top, the tool proves it, and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. If you take one thing from this page on “nested if formula”, make it the habit rather than the keystrokes: set the problem up with labelled inputs, reference those cells, and let Excel do the recomputing. Bookmark the page for the syntax, but do the example once in a blank sheet and check it against the tool above — five minutes of hands-on practice fixes the method in memory far better than re-reading, and it surfaces the small snags while they are still harmless. After that the technique is genuinely yours: faster than searching for it again, and reliable enough to drop into work that other people depend on.

Common mistakes

  • Putting conditions in the wrong order — nested IFs test top-to-bottom; put the most restrictive condition first (>90 before >80) or a score of 95 will match the wrong branch.
  • Mismatching parentheses — each IF adds one opening and one closing parenthesis; count them carefully or use the formula bar's colour-coding.
  • Exceeding 64 nesting levels — extremely rare in practice, but if reached, switch to IFS() or a VLOOKUP against a helper table.

Frequently asked questions

How many IFs can I nest in Excel?

Excel allows up to 64 levels of nested IF functions. In practice, more than 4–5 levels becomes hard to read and maintain; switch to IFS() or a lookup table (VLOOKUP/XLOOKUP against a tier table) for cleaner logic.

What is the difference between nested IF and IFS()?

IFS() lists condition-result pairs in a flat sequence — =IFS(A1>90,"A",A1>80,"B",TRUE,"F") — without nested brackets. It is easier to read and extend, but requires Excel 2019 or 365. Nested IF works in every Excel version and in Google Sheets.

Can I use nested IF with AND or OR?

Yes. =IF(AND(A1>0,B1>0),"Both positive","No") tests two conditions simultaneously. You can combine AND/OR inside any IF, including nested ones: =IF(A1>90,"A",IF(AND(A1>70,B1="Pass"),"B","F")).

Other ways people ask this

This is also commonly searched as “nested if and”, “nested if function excel”, “if and nested if function in excel” and “nested if with and function in excel”. They describe the identical operation, so you are in the right place no matter how you phrased it.

Why do people search for this in so many different ways?

Because the same task has many names. “nested if and”, “nested if function excel”, “if and nested if function in excel” all point at the one operation explained on this page, which is why they all lead here.