EXCEL SOLUTIONS

IF function in Excel

Shows one result when a test is true and another when it is false.

BeginnerLogic

Syntax

=IF(logical_test, value_if_true, [value_if_false])
Arguments of IF
ArgumentWhat it means
logical_testThe question, such as B2>100.
value_if_trueWhat to show when the answer is yes.
value_if_falseWhat to show when the answer is no. If left out, FALSE is shown.

Examples with results

Every result below is calculated by the practice engine on the sample data shown, not typed in by hand.

Monthly budget (fictional)

RowABC
1CategoryPlannedActual
2Rent12001200
3Groceries400462
4Transport150128
5Utilities180171
6Fun120160
7Savings300300
Monthly budget (fictional) Row 1 holds the headings. All data is fictional. Dates are year-month-day.

Download CSV

  • =IF(C3>B3,"Over budget","OK")Over budget

    Is Groceries over its plan?

Stock levels (fictional)

RowABCDE
1SKUItemOn handReorder levelUnit cost
2A-100Hinge 40 mm120500.8
3A-110Bracket set18304.2
4A-120Oak board61022
5A-130Zinc pin3001000.15
6A-140Door handle9127.5
Stock levels (fictional) Row 1 holds the headings. All data is fictional. Dates are year-month-day.

Download CSV

  • =IF(C3<=D3,"Reorder","OK")Reorder

    Does the bracket set need reordering?

Class scores (fictional)

RowABCD
1StudentMathsScienceEnglish
2Layla788591
3Omar627058
4Priya958892
5Quinn455261
6Rosa887984
Class scores (fictional) Row 1 holds the headings. All data is fictional. Dates are year-month-day.

Download CSV

  • =IF(B3>=60,"Pass","Fail")Pass

    Pass mark of 60

Try it yourself

Change the formula or switch to other sample data.

Press Calculate to see the result.

The practice box runs in your browser with BDK’s own calculator, which covers about 60 common functions. Cell references work as in Excel (B2, B2:B9). Your formulas are not saved or sent anywhere. For anything unusual, check the result in Excel itself.

How people use IF at work

  • Education

    Pass or fail for one student.

    =IF(AVERAGE(B2:D2)>=70,"Merit","Standard")Merit
    Data: Class scores (fictional)
  • Operations

    Flag items that need ordering.

    =IF(C2<=D2,"Reorder","OK")OK
    Data: Stock levels (fictional)

Common mistakes and tips

  • Text in a result needs quotes: "Pass", not Pass.
  • Nesting many IFs gets hard to read. Use IFS (Excel 2019 and later) or a lookup table instead.

Works in

All versions of Excel, and Google Sheets.

Related formulas

IFSANDORIFERROR

Lessons that use it

Tools that help

Need Something Different? Let’s Talk.

Looking for different features or something built around your workflow? Share your idea with us.