What IF Does
The IF function checks whether a condition is true or false and returns one value for true and another for false. It is the foundation of decision-making in Google Sheets, letting you automate labels, flags, and calculations based on your data. Almost every spreadsheet workflow uses IF at some point.
Syntax
=IF(condition, value_if_true, value_if_false)
| Parameter | Description |
|---|---|
| condition | A logical test that evaluates to TRUE or FALSE (e.g., A1 > 100). |
| value_if_true | The value returned when the condition is TRUE. Can be text, a number, or another formula. |
| value_if_false | The value returned when the condition is FALSE. Optional — defaults to FALSE if omitted. |
Basic Examples
Example 1: Pass or Fail
You have student scores in column B and want to mark whether each student passed (score >= 60).
| A | B | C (Formula) | C (Result) | |
|---|---|---|---|---|
| 1 | Name | Score | Status | Status |
| 2 | Emma | 78 | =IF(B2>=60,"Pass","Fail") | Pass |
| 3 | Jake | 45 | =IF(B3>=60,"Pass","Fail") | Fail |
Example 2: Bonus Eligibility
Sales reps earning over $10,000 in revenue get a bonus flag.
| A | B | C (Formula) | C (Result) | |
|---|---|---|---|---|
| 1 | Rep | Revenue | Bonus? | Bonus? |
| 2 | Sarah | 12500 | =IF(B2>10000,"Yes","No") | Yes |
| 3 | Tom | 8200 | =IF(B3>10000,"Yes","No") | No |
Example 3: Stock Alert
Flag items where inventory drops below the reorder point.
| A | B | C (Formula) | C (Result) | |
|---|---|---|---|---|
| 1 | Product | Qty | Alert | Alert |
| 2 | Widget A | 5 | =IF(B2<10,"Reorder","OK") | Reorder |
| 3 | Widget B | 42 | =IF(B3<10,"Reorder","OK") | OK |
Advanced Examples
Nested IF — Assigning Letter Grades
When you need more than two outcomes, nest IF functions inside each other.
=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2>=60,"D","F"))))
For a score of 85, this returns "B". The formula checks each threshold from highest to lowest and stops at the first match.
IF with AND/OR — Multi-Condition Check
A sales lead qualifies only if the deal size is over $5,000 AND the lead source is "Inbound."
=IF(AND(B2>5000, C2="Inbound"), "Qualified", "Nurture")
To qualify if either condition is met, swap AND for OR:
=IF(OR(B2>5000, C2="Inbound"), "Qualified", "Nurture")
Common Mistakes
- Forgetting quotes around text values.
=IF(A1>5, Yes, No)throws an error. Text must be wrapped in double quotes:"Yes"and"No". - Nesting too many IFs. Deeply nested IF formulas become unreadable. If you have more than 3-4 levels, consider using IFS or SWITCH instead.
- Comparing text without matching case.
=IF(A1="yes",...)won't match "YES" or "Yes". Use=IF(LOWER(A1)="yes",...)to handle mixed case.
SheetAI Tip
Don't want to memorize this syntax? With SheetAI, just type what you need in plain English — like "if sales > 1000, mark as High Priority" — and the formula is generated for you. Install SheetAI to try it free.