IF in Excel: what it does and how to use it

IF tests something and gives one answer when the test passes and another when it fails. It is the building block almost every other conditional formula is made from.

Syntax

IF(logical_test, value_if_true, [value_if_false])

When to use it

Whenever a cell should say one thing in some circumstances and something else the rest of the time. Flagging what is overdue, hiding a zero, labelling a row.

What trips people up

Piling IF inside IF inside IF becomes hard to read fast. Past two or three levels, IFS is easier to read and easier to fix later.

Watch it built, step by step

Questions

How do I test two things at once?

Put AND or OR inside the test: =IF(AND(B2>100,C2="Yes"),"Bonus","") needs both to be true; OR needs only one.

Why does my IF show FALSE?

The third argument was left out, so when the test fails IF has nothing to show and returns FALSE. Add "" as the third argument to leave the cell blank instead.

How do I check whether a cell is empty?

=IF(A2="","Missing","OK"). ISBLANK works too, but it treats a formula that returns "" as not blank, which catches people out.

Related functions

Settings: separator, Excel version

Argument separator

Set by your computer's language, not by the file. A frequent cause of a correct-looking formula being rejected.

Excel version

XLOOKUP, IFS, TEXTBEFORE and TEXTJOIN need Microsoft 365 or 2021; older versions return #NAME? instead. Choosing the older one switches every walkthrough to a formula that works there.