ExcelUnpackUnpack Excel, one formula at a time.
Log inSign up

Lesson 33 · Logic

Nested IF in Excel

A nested IF puts one IF inside another, so a formula can choose between more than two answers. Check the highest level first, and the formula stops at the first test that is true.

Practice this lesson →Pro lesson. The first 4 lessons are free.

What you will learn

  • Choose between more than two answers
  • Put the tests in the right order

How it works

Put a new IF where the "false" answer goes. Check the highest grade first. As soon as a test is true, the spreadsheet stops checking.

Count your parentheses! You need one ) at the end for each IF.

Formulas at a glance

=IF(B2>=90,"A",IF(B2>=80,"B",…))The pattern to follow

Example

Write the formula to give Ana a grade: A for 90 or more, B for 80 or more, C for 70 or more, otherwise F.

ABCD
1StudentScoreGradePassed?
2Ana92
3Ben85
4Cleo71
5Dev66
6Eli79
7Fay98
8

Click C2 and type =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","F"))), then press Enter.

The answer is A.

When to use it

  • Letter grades: A, B, C, F
  • Price bands or shipping levels
  • Any label with three or more choices

Common mistakes

  • Checking the lowest level firstStart with the highest test, like B2>=90.
  • Not enough ) at the endYou need one ) for each IF.
  • Too many levels to readIFS or a lookup table can be easier.

Quick check

Why check the highest grade first?

  1. It is faster
  2. Once a test is true, the rest are skipped
  3. The spreadsheet sorts them
  4. It doesn't matter
Show the answer

B. Once a test is true, the rest are skipped If you checked 70 first, a 95 would get a C!

Practice it on a real sheet

Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.

Nested IF in Excel: how it works, with examples · ExcelUnpack