AnalystPracticeGuides
DashboardSign up

The Excel IF function: syntax, examples and common mistakes

IF checks a condition and returns one value if it is true and another if it is false: =IF(condition, value_if_true, value_if_false). Most business rules in a spreadsheet are an IF.

How do you write an IF formula?

Give a 10% bonus to anyone rated 4 or higher, with the rating in D2 and the salary in C2:

=IF(D2>=4,C2*0.1,0)

How do you test text?

Put the text in quotes. Excel does not care about upper or lower case here:

=IF(B2="Paid","Done","Chase")

How do you check for an empty cell?

=IF(A2="","Missing",A2)

ISBLANK(A2) also works, but it treats a cell with a formula that returns "" as not blank, so A2="" is usually the safer test.

What are the common mistakes?

Edge cases: the rule says "4 or higher", so >=4, not >4. Tests check exactly this.

Numbers in quotes: =IF(D2>="4",…) compares with the text "4" and gives wrong results.

Missing value_if_false: if you leave it out, IF returns FALSE, which then shows up in reports.

When should you not use IF?

When you need more than two or three outcomes, use IFS or a lookup table instead of nesting many IFs. When you only want to hide errors, use IFERROR or IFNA.

Try it yourself. Practise this in a real spreadsheet in your browser, with instant feedback.
Practise IF Practise comparisons

Updated November 2026.

← All free guides