Course outline / Logical functions

Lesson 21 of 75 · Intermediate · 4 exercises

Nested IF

Put IF inside IF for three or more outcomes, and know when to use IFS instead.

Start this lesson free

What you'll practise

  1. Three outcomes with two IFs
  2. The same grade for another row
  3. Order matters
  4. The same with IFS

Three outcomes with two IFs

One IF gives two outcomes. For three, put a second IF in the "otherwise" part of the first:

=IF(B2>=80, "Distinction", IF(B2>=50, "Pass", "Fail"))

Excel tries the first test; only if it fails does it move on to the inner IF.

In cell D2, grade Ana's score in B2 that way: Distinction at 80 or more, Pass at 50 or more, otherwise Fail.

The same grade for another row

In cell D2, write the same nested IF for Ben's score in B3.

Order matters

Tests are checked in order, so the strictest comes first. If B2>=50 came first, a score of 85 would stop there and never reach Distinction.

In cell D2, grade Cal's score in B4 with the tests in the right order.

The same with IFS

IFS does the same job without nesting. Its last pair TRUE, "Fail" catches everything else.

In cell D2, grade Dee's score in B5 with IFS: Distinction at 80 or more, Pass at 50 or more, otherwise Fail.

Try it in a real spreadsheet

Every step checks your answer instantly and tells you exactly what to fix.

Start the lesson

Function guides

← Decisions with IF, AND and ORChecking cells with IS functions →