ExcelFluent
Start free

How to use the IF function in Excel

IF checks a condition and returns one value when it is true and another when it is false: Pass or Fail, Overdue or On time, Bonus or no bonus.

Syntax

=IF(logical_test, value_if_true, value_if_false)
logical_test
Something that is TRUE or FALSE, such as B2>=60.
value_if_true
What to show when the test is true. Text goes in quotes.
value_if_false
What to show otherwise.

Try it now · free, no sign-up

Grade a class

  1. In C2, show Pass if the score is 60 or more, otherwise Fail. It will be copied down to row 7.
  2. In D2, give a grade: A for 90+, B for 80+, C for 60+, otherwise F. Use nested IFs or IFS.
ABCD
1StudentScoreResultGrade
2Emma78
3Liam52
4Olivia91
5Noah64
6Ava45
7Mason83

Loading the live spreadsheet…

Nested IF vs IFS

A nested IF puts another IF in the "false" slot. IFS (Excel 2019 and later) lists the tests in pairs instead: =IFS(B2>=90,"A",B2>=80,"B",B2>=60,"C",TRUE,"F"). The final TRUE is the catch-all; without it, scores below 60 give #N/A.

Order matters: test the highest band first. If you test >=60 first, a 95 stops there and gets a C.

Combining conditions

Use AND or OR inside the test: =IF(AND(B2>=60,C2="Yes"),"Eligible","Not eligible"). In Excel, AND and OR are functions, not words between two tests.

Common mistakes

Text without quotes
=IF(B2>=60,Pass,Fail) gives #NAME?. Write "Pass".
Bands in the wrong order
Test from the highest band down, or every score lands in the first band it passes.
Writing B2>=60 AND C2="Yes"
Write AND(B2>=60,C2="Yes").

Practice it until it sticks

ExcelFluent has 42 hands-on lessons, from SUM to XLOOKUP, plus 5 real work projects and a final challenge that uses everything. Every answer is checked instantly. The first 5 lessons and 1 work project (an invoice with tax) are free.

Start the free lessons → Open the full IF function lesson

Frequently asked questions

How many IFs can you nest?

Up to 64, but beyond 3 or 4 use IFS, or a lookup table with VLOOKUP and TRUE.

How do I make IF return a blank?

Use two double quotes: =IF(B2="","",B2*2).

Related practice