WHAT DOES IF DO

The IF function returns one value if a condition is true and another if it's false. It's commonly used to test logic — for example, whether a number is above a threshold or if a cell contains specific text.

WHEN TO USE IT
  • You want to show different results based on a condition
  • You're testing numbers, text, or logical outcomes
  • You want to 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

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

COMMON PITFALLS AND 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