Microsoft Excel · Logical Functions

Excel's IF() Function

Learn to use Excel's IF function to make logical decisions, return different results, calculate discounts, and build nested IF formulas.

Start here

Overview

The IF function lets an Excel formula make a decision. It tests a condition and returns one result when the condition is TRUE and another result when it is FALSE. In this lesson, you will use IF to calculate a trip discount and then extend the idea with a nested IF formula for multiple outcomes.

What You Will Learn

  • Identify the logical test, value-if-true, and value-if-false arguments in an IF function.
  • Write an IF formula that returns a calculated discount.
  • Copy an IF formula through a range and verify the results.
  • Use comparison operators in logical tests.
  • Construct and interpret a nested IF formula for three possible outcomes.
  • Troubleshoot common IF-function errors.

Before You Begin

  • Basic Excel functions
  • Relative cell references
  • Copying formulas with the fill handle

Why This Matters

IF is one of Excel's most useful logical functions because it allows a worksheet to apply business rules automatically. It can classify results, calculate discounts, flag exceptions, assign status labels, and support many other decision-based spreadsheet tasks.

Plan Your Study

  • Review the three arguments of the IF function.
  • Work through the TripData discount example in the Learn tab.
  • Download the TripData workbook and reproduce the formulas yourself.
  • Watch both videos in the Watch tab, including the nested IF/OR lesson.
  • Use the Practice tab to create and explain your own logical formulas.

Next step

Read the complete chapter.

The Learn tab contains the written lesson from Surviving Statistics.

Go to Learn

Written lesson

Learn Excel's IF() Function

Learn to use Excel's IF function to make logical decisions, return different results, calculate discounts, and build nested IF formulas.

Advertisement

The IF() Function

The IF() function is a logical function. It returns one value if a condition is true and another value if the condition is false. In this lesson, you will use the IF function to calculate a discount when the total cost of a trip exceeds a specified amount.

IF() Function Syntax

The basic syntax of the IF() function is:

=IF(condition to check, value if true, value if false)

The values returned by IF can also be computations. In the following steps, you will use the IF() function to compute a customer’s discount based on the cost of the trip.

1. Add the Discount Column

In the TripData workbook, move to cell F4 in the January worksheet, type Discount, and then press Enter.

The No Fault Travel agency gives a 5% discount if the total cost of the trip exceeds $2,500. Before entering the formula, frame the IF statement in plain language:

Excel IF function arguments showing the logical test, true result, and false result
IF ArgumentBusiness RuleExcel Expression
Logical testDoes the trip exceed $2,500?E5>2500
Value if trueGive a 5% discount.E5*0.05
Value if falseNo discount.0

2. Enter the IF Formula

In cell F5, type:

=IF(E5>2500,E5*0.05,0)

Excel worksheet showing the IF formula used to calculate a trip discount

This formula asks whether the value in E5 is greater than 2500. If it is, Excel calculates 5% of E5. If it is not, Excel returns zero.

3. Copy the Formula

Copy the formula from F5 through F14. You may double-click the fill handle on cell F5 to quickly copy the discount formula. Add accounting formatting as shown in the lesson example.

Excel worksheet showing the IF formula copied through the Discount column

Nested IF Statements

Sometimes a worksheet must return more than two possible outcomes. One approach is to place one IF function inside another. This is called a nested IF.

For example, suppose higher trip costs qualify for a larger discount:

=IF(E5>5000,E5*0.08,IF(E5>2500,E5*0.05,0))

This formula evaluates the highest threshold first. If the trip exceeds $5,000, it returns an 8% discount. Otherwise, Excel evaluates the second IF and returns either a 5% discount or zero.

Excel example illustrating the logic of a nested IF formula

Comparison Operators Used in IF

OperatorMeaning
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to
=Equal to
<>Not equal to

Common Mistakes

  • Reversing the value-if-true and value-if-false arguments.
  • Using the wrong comparison operator, such as > when the rule means >=.
  • Forgetting quotation marks around text results, such as "Pass".
  • Putting nested conditions in an illogical order. When testing thresholds such as $5,000 and $2,500, test the higher threshold first.
  • Failing to verify the formula with values on both sides of the decision threshold.

You have now used Excel's IF() function to automate a business decision. Experiment with your own data and consider other situations where a spreadsheet could return different results based on a logical test.

Advertisement

Next step

See the concepts demonstrated.

Continue to Watch for chapter videos and worked examples.

Go to Watch

See it explained

Watch

Choose the explanation or example that best supports your learning.

Next step

Apply what you have learned.

Use the guided questions and activities in Practice.

Go to Practice

Apply what you learned

Practice Excel's IF() Function

Use the companion calculator and activities below to reinforce the chapter concepts.

Guided Practice

  • In =IF(E5>2500,E5*0.05,0), identify the logical test, value if true, and value if false.
  • If E5 contains 3000, what result should =IF(E5>2500,E5*0.05,0) return?
  • Create a formula that displays "Pass" when A2 is at least 70 and "Review" otherwise.
  • Create a formula that gives an 8% discount when a trip exceeds $5,000, a 5% discount when it exceeds $2,500, and no discount otherwise.
  • Explain why the order of conditions matters in a nested IF formula.
  • Change several TripData values above and below the threshold and verify that the formula recalculates correctly.
  • Create your own business example in which an IF function would automate a decision.

Challenge Yourself

Resources will be added as this lesson grows.

Check Your Understanding

Resources will be added as this lesson grows.

Next step

Save the materials you may need later.

Open Resources for the study sheet, spreadsheets, and related learning materials.

Go to Resources

Keep learning

Resources

Study sheets, downloadable files, companion tools, and related lessons for this chapter.

For educators

Teaching this chapter?

The Instructor tab contains objectives, teaching ideas, assessments, and a printable guide.

Open Instructor Resources

LutherMaddy.com — Helping Humans Learn

Excel's IF() Function: Instructor Resources

Teach this lesson

Instructor Resources

Classroom-ready objectives, teaching ideas, questions, and assessment materials for this chapter.

Learning Objectives

  • Identify the logical test, true result, and false result in an IF function.
  • Write and copy an IF formula that returns a calculated discount.
  • Construct a nested IF formula for three possible outcomes.
  • Interpret and troubleshoot logical formulas.

Prerequisite Knowledge

  • Basic functions
  • Relative references
  • Copying formulas

Teaching Outline

  • Introduce decision-making in spreadsheets.
  • Diagram the three IF arguments.
  • Create and copy the basic discount formula.
  • Change input values and observe recalculation.
  • Extend the formula with a nested IF.

Key Concepts

  • IF returns one result when a test is true and another when it is false.
  • Comparison operators include >, <, >=, <=, =, and <>.
  • Nested IF functions support more than two possible outcomes.
  • Conditions should be arranged in a logical order.

Classroom Demonstration

  • Change a trip cost from below to above the threshold and show the result update.
  • Build the nested formula one IF at a time and evaluate each branch.

Questions to Ask

  • What business decisions can an IF formula automate?
  • Why does the order of nested conditions matter?
  • When should a formula return text instead of a number?

Teaching Notes

  • Encourage students to state the rule in plain language before writing the formula.
  • Use indentation or color coding when explaining nested formulas.
  • Remind students that text results require quotation marks.

Assessment Ideas

  • Assign one numeric IF formula and one text-returning IF formula.
  • Have students diagnose a formula with reversed true and false results.
  • Require a three-level nested IF classification.

Grading Rubric

CriterionPoints
Logical test is correct2
True and false results are correct2
Formula syntax is accurate2
Formula copied and verified2
Nested logic explained clearly2
Total10

Exam and Discussion Questions

Basic

  • Identify the three arguments in =IF(E5>2500,E5*0.05,0).

Applied

  • Create a formula that returns Pass when a score is at least 70 and Review otherwise.

Conceptual

  • Explain why nested IF conditions should often be tested from highest to lowest.

Keep Exploring

Continue Learning

Explore step-by-step lessons, interactive calculators, downloadable study sheets, and practical educational resources.