Need Excel to make decisions for you? IF tests a condition and returns one value when true, another when false. It’s the foundation of logic in spreadsheets and one of the most powerful functions you’ll learn.
What Makes IF Useful
IF brings intelligence to your spreadsheets:
- Automatic decisions – Let Excel choose based on your criteria
- Error prevention – Display messages instead of confusing errors
- Status indicators – Show Pass/Fail, Yes/No, or custom labels
- Conditional calculations – Perform math only when conditions are met
- Data validation – Flag problems or highlight issues automatically
The Syntax
=IF(logical_test, value_if_true, value_if_false)Test a condition, get one result if true, another if false. All three parts are required.
Example 1: Pass or Fail
Determine if students passed (score 60 or higher):
| Student | Score |
|---|---|
| Alice | 85 |
| Bob | 52 |
| Carol | 74 |
| David | 48 |
Formula: =IF(B2>=60, "Pass", "Fail")
Result in C2: Pass
Copy down and Excel evaluates each score. Alice and Carol get “Pass”, Bob and David get “Fail”.
Example 2: Sales Commission
Calculate commission (10% if sales exceed $10,000, otherwise 5%):
| Employee | Sales |
|---|---|
| Sarah | $15,200 |
| Mike | $8,500 |
| Jennifer | $12,800 |
Formula: =IF(B2>10000, B2*0.1, B2*0.05)
Result in C2: $1,520
Sarah and Jennifer get 10%, Mike gets 5%. The formula does the math inside the IF statement.
Example 3: Blank Cell Handling
Show a message if a cell is empty:
| Product | Price |
|---|---|
| Widget A | $29.99 |
| Widget B | |
| Widget C | $45.50 |
Formula: =IF(B2="", "Price Missing", B2)
Result in C2: $29.99
Result in C3: Price Missing
The empty cell triggers the “Price Missing” message. Otherwise it shows the price.
Example 4: Discount Eligibility
Apply 15% discount for orders over $500:
| Order | Amount | Final Price |
|---|---|---|
| 001 | $650 | |
| 002 | $420 | |
| 003 | $580 |
Formula: =IF(B2>500, B2*0.85, B2)
Result in C2: $552.50
Orders 001 and 003 get discounted. Order 002 stays at $420.
Example 5: Text Comparison
Check if a region matches:
| Employee | Region | Bonus |
|---|---|---|
| Tom | West | |
| Lisa | East | |
| Marcus | West |
Formula: =IF(B2="West", "$500", "$0")
Result in C2: $500
Tom and Marcus get bonuses. Lisa doesn’t. Text comparisons are case-insensitive by default.
Example 6: Greater Than or Equal
Flag inventory that needs reordering (below 20 units):
| Product | Stock | Status |
|---|---|---|
| Item A | 45 | |
| Item B | 12 | |
| Item C | 23 |
Formula: =IF(B2<20, "Reorder", "OK")
Result in C2: OK
Result in C3: Reorder
Item B triggers the reorder alert. Items A and C are fine.
Common Comparison Operators
| Operator | Meaning | Example |
|---|---|---|
| = | Equal to | A2=”West” |
| > | Greater than | B2>100 |
| < | Less than | C2<50 |
| >= | Greater than or equal | D2>=60 |
| <= | Less than or equal | E2<=1000 |
| <> | Not equal to | F2<>”” |
Tips for Writing IF Statements
Text in Quotes
=IF(A2="Yes", 100, 0)is correct=IF(A2=Yes, 100, 0)causes an error
Numbers Without Quotes
=IF(B2>50, "High", "Low")is correct=IF(B2>"50", "High", "Low")works but is bad practice
Empty Cells
- Test with
A2=""for blank cells - Or use
ISBLANK(A2)for a cleaner approach
Nested IF (Use Sparingly)
- You can put IF inside IF
- Gets messy fast
- Consider IFS function for multiple conditions
Common Mistakes to Avoid
Missing Quotes
- Text must be in quotes: “Pass”, “Fail”, “Yes”
- Numbers don’t need quotes: 100, 0, 50
Wrong Comparison
=IF(A2="Yes" or "Y")doesn’t work- Use
=IF(OR(A2="Yes", A2="Y"), ...)instead
Checking for Zero
IF(A2, "Has Value", "Empty")treats 0 as false- Use
IF(A2<>"", "Has Value", "Empty")for clarity
Start Using It
Pick a column with numbers or text. Think of a condition to test. Write an IF formula that returns different results. Copy it down and watch Excel make decisions for every row.
IF becomes second nature once you start thinking in conditions.
Questions about IF? Ready to explore nested IFs or the IFS function? Let’s connect.

