Skip to content

Excel function guide · Logic

IF function in Excel

IF checks whether a condition is true and returns one value if it is and another if it isn't, for example "Hit" when sales reach the target and "Miss" when they don't. Either result can be text, a number or another calculation.

Syntax

=IF(logical_test, value_if_true, [value_if_false])
ArgumentRequired?What it means
logical_testRequiredA comparison that is TRUE or FALSE, such as C2>=B2.
value_if_trueRequiredWhat to return when the test is TRUE: text in quotes, a number, a cell or a formula.
value_if_falseOptionalWhat to return when the test is FALSE. Left out, IF returns FALSE.

IF examples

Every example uses this small table. The results are what Excel shows in the cell.

ABC
1RepTargetSales
2Aisha20,00023,500
3Marco18,00016,200
4Priya22,00022,000
5Jonas15,00017,900
6Lena25,00021,000
  1. 1. Label a result

    =IF(C2>=B2, "Hit", "Miss")

    Result: Hit

    Aisha's 23,500 is at least her 20,000 target.

  2. 2. Calculate in a branch

    =IF(C2>=B2, (C2-B2)*0.1, 0)

    Result: 350

    A bonus of 10% of the amount above target, or 0 if the target was missed: (23,500 − 20,000) × 0.1.

  3. 3. > versus >=

    =IF(C4>B4, "Hit", "Miss")

    Result: Miss

    Priya sold exactly her 22,000 target, but > means strictly greater. Use >= when meeting the target counts.

Try it now

Practise IF in a live sheet.

Type each formula yourself. Answers are checked by the same engine as the full course. No account needed.

Try it · IF
0 XP
D2
A
B
C
D
E
F
1
Rep
Target
Sales
Status
Bonus
2
Aisha
20000
23500
3
Marco
18000
16200
4
Priya
22000
22000
5
Jonas
15000
17900
6
Lena
25000
21000
7
8
Double-click or start typing to edit

Step 1 of 3

In D2, show Hit if Sales are at least the Target, otherwise Miss.

Common IF mistakes

Practise this in Excel Quest

IF: hit or missFree

Course 4 · Logic & Error Handling · 10 min

Make formulas decide: target status, bonuses, shortfalls and next steps for a sales team.

This lesson is free: create an account and it opens straight away.

Related functions

All Excel function guides