Nested conditional statements in Excel let you test multiple conditions in a single formula and return different results depending on which condition is true. The most common form is nesting IF functions inside each other, like =IF(A1>90,"A",IF(A1>80,"B","C")). This guide shows you how to build them correctly, avoid common errors, and troubleshoot when things go wrong.

What You'll Need

  • Microsoft Excel (2016 or later, including Microsoft 365) on Windows or Mac.
  • A worksheet with the data you want to test (e.g., scores, sales figures, dates).
  • Basic familiarity with entering formulas and using cell references.

Step-by-Step

  1. Identify your conditions and outcomes. Write down each condition and the result you want if it's true. For example, for a score in cell A1: if greater than 90, show "A"; if greater than 80, show "B"; otherwise "C".
  2. Start with the outermost IF. Click the cell where you want the result. Type =IF(. The first argument is the first condition. For the example, type =IF(A1>90,"A",.
  3. Add the next IF as the "value if false" argument. After the comma, type another IF(. This becomes the next condition. Continue: =IF(A1>90,"A",IF(A1>80,"B",.
  4. Finish the final "value if false". For the last condition, type the result if that condition is false. In the example, type "C". Then close all the parentheses. The full formula: =IF(A1>90,"A",IF(A1>80,"B","C")).
  5. Press Enter. Excel evaluates the conditions in order. If the first is true, it stops and returns that result; if false, it moves to the next IF.
  6. Test with different values. Change the value in A1 to verify each branch works. For instance, 95 should return "A", 85 should return "B", and 70 should return "C".
  7. Copy the formula to other cells. Use the fill handle (the small square at the cell's bottom-right) to drag the formula down or across, adjusting references as needed. If you want references to stay fixed, use absolute references like $A$1.

For more than a few conditions, consider using IFS (available in Excel 2016 and later) which is simpler: =IFS(A1>90,"A",A1>80,"B",TRUE,"C"). The TRUE at the end acts as a catch-all.

Common Mistakes

  • Wrong order of conditions. Excel checks conditions from left to right. If you put A1>80 before A1>90, a score of 95 would return "B" because it's true for the first condition. Always order from most specific to least specific.
  • Missing parentheses. Each IF needs its own closing parenthesis. Count them: for three IFs, you need three closing parentheses at the end. Excel will often show a popup hint, but it's easy to miscount.
  • Using text without quotes. Text results must be in double quotes, like "A". Numbers don't need quotes. If you forget, Excel treats the text as a named range and returns a #NAME? error.
  • Comparing text with > or <. Text comparisons work alphabetically, but they can be confusing. For example, "apple" > "Banana" is TRUE because lowercase letters have higher ASCII codes. Use exact matches with = or EXACT for case-sensitive comparisons.
  • Using AND/OR incorrectly. If you need multiple conditions to be true, use AND inside IF: =IF(AND(A1>10,B1<5),"Yes","No"). Don't write =IF(A1>10 AND B1<5,...)—that's not valid Excel syntax.

Tips

  • Use named ranges. Instead of A1, name the cell (e.g., Score) to make formulas readable: =IF(Score>90,"A",...).
  • Limit nesting to 7 levels. Excel only allows up to 64 nested IFs in modern versions, but beyond 7 it becomes very hard to manage. Use IFS or a lookup table instead.
  • Use a lookup table for many categories. Instead of nested IFs for letter grades, create a table with thresholds and use VLOOKUP or XLOOKUP with approximate match. This is easier to maintain.
  • Test each branch. Put sample values in a column and check the results. This catches logic errors early.
  • Use the Formula Builder. Click the fx button next to the formula bar to see a dialog that helps you enter arguments step by step.

Troubleshooting

Formula returns #NAME? This usually means you have a text string without quotes, or a misspelled function name. Check that all text results are in double quotes and that you wrote IF correctly.

Formula returns #VALUE! This often happens when you compare a number to text or use a cell that contains an error. Ensure your data types match. For example, if A1 contains text, A1>90 will error.

Formula returns the wrong result. Check the order of your conditions. Remember Excel evaluates left to right. Also, verify that your comparisons use the correct operators (>, <, =, <>).

Too many arguments error. You likely have an extra comma or a missing argument. For each IF, you need exactly three arguments: condition, value if true, value if false. Count the commas carefully.

Parentheses mismatch. Excel will often show a red highlight or a popup when parentheses don't match. Click the formula bar and look for the colored parentheses—each open parenthesis should have a matching close.

If none of these work, test a simple IF first. Enter =IF(A1>90,"A","B") in a cell. If that works, add complexity step by step. This isolates the problem.

Frequently Asked Questions

Can I nest more than 7 IF functions?

Yes, Excel 2016 and later allow up to 64 nested IFs, but it's not recommended. Beyond 7, the formula becomes error-prone and hard to read. Use IFS or a lookup table instead.

What's the difference between nested IF and IFS?

IFS lets you list multiple conditions and results without nesting: =IFS(condition1, result1, condition2, result2, ...). It's simpler for 3+ conditions. However, IFS doesn't have a built-in "else"—you add TRUE as a final condition for that.

How do I check if a cell is blank in a nested IF?

Use ISBLANK: =IF(ISBLANK(A1),"Empty",IF(A1>90,"A","B")). Or use A1="" to check for an empty string.

Can I use AND and OR inside nested IF?

Yes. For example: =IF(AND(A1>10,B1<5),"Yes",IF(OR(A1>10,C1="OK"),"Maybe","No")). Just remember to enclose the AND/OR function as the condition.

Why does my formula return 0 instead of a blank?

If you have "" as a result, it should show blank. If you get 0, you might have a formula like =IF(A1>90,"A",)—the missing false argument defaults to 0. Always provide a value or "" for every branch.

Can I use cell references in the results?

Yes, you can return a cell reference's value, like =IF(A1>90,B1,C1). But if you want to return the cell's content, just use the reference. If you want to return the cell address as text, you'd need a different approach.