The IF function returns one value if a condition is true and another if it's false. This guide explains how IF works and includes practical examples you can use immediately.

WHAT THE IF FUNCTION DOES

IF evaluates a logical condition and returns different results based on whether that condition is true or false. It's commonly used to test numbers against thresholds, check if cells contain specific text, or classify data based on criteria.

WHEN TO USE IF

Use IF when you want to:

  • Show different results based on a condition
  • Test numbers, text, or logical outcomes
  • Flag or classify data (e.g., Pass/Fail, Bonus/No Bonus)
FORMULA SYNTAX
IF(logical_test, value_if_true, value_if_false)
ArgumentDescription
logical_testThe condition you want to check (e.g. A1>10)
value_if_trueWhat to return if the condition is true
value_if_falseWhat to return if the condition is false
EXAMPLE 1: CLASSIFYING PASS/FAIL

We want to show "Pass" if the score is above 60, and "Fail" otherwise.

AB
1StudentScore
2Alice75
3Bob58
4Carol91
5David60
=IF(B2>60, "Pass", "Fail")

Result: Alice → Pass, Bob → Fail

Need help applying this? Try this in Numstro Builder

EXAMPLE 2: APPLYING A BONUS ONLY IF SALES TARGET IS MET

We want to show a bonus of $1,000 if sales are >= 1000, and 0 otherwise.

AB
1RepSales
2John1200
3Jane900
4Raj1000
5Ana1100
=IF(B2>=1000, 1000, 0)

Result: John → 1000, Jane → 0, Raj → 1000

Need help applying this? Try this in Numstro Builder

COMMON MISTAKES & EDGE CASES
  • Use >, <, >=, etc., for logical comparisons
  • Text values must be enclosed in quotes
  • Make sure your logic expressions are valid or Excel will return an error
  • You can nest multiple IF functions for complex logic (but this can get messy)
RELATED FUNCTIONS
  • IFS — cleaner way to handle multiple conditions
  • SWITCH — alternative to multiple IFs
FURTHER READING

Official Microsoft documentation:
IF — Microsoft Support