Logical
How to Use the IF Function in Excel (with Multiple Conditions)
The IF function returns one value when a condition is true and another when it is false. It is the foundation of decision-making in spreadsheets: flagging, scoring, categorising, and conditional math.
This guide covers the basic pattern, how to combine conditions with AND and OR, and how to avoid the deeply nested IFs that become impossible to read.
IF syntax
=IF(logical_test, value_if_true, value_if_false) | Argument | Required | What it does |
|---|---|---|
logical_test | Required | Any expression that evaluates to TRUE or FALSE, e.g. B2>=60. |
value_if_true | Required | What to return when the test is TRUE. Wrap text in "quotes". |
value_if_false | Required | What to return when the test is FALSE. |
Note: Identical in Google Sheets.
Examples
Real, copy-paste-ready formulas.
1. Simple pass/fail
=IF(B2>=60, "Pass", "Fail") The test B2>=60 returns TRUE or FALSE; IF then returns the matching text. Text values must be in double quotes.
2. Two conditions with AND
=IF(AND(B2>=60, C2="Yes"), "Eligible", "No") AND() is TRUE only when every condition is true. Use OR() instead if any one condition should be enough.
3. Multiple bands: use IFS instead of nesting
=IFS(B2>=90,"A", B2>=80,"B", B2>=70,"C", TRUE,"F") IFS reads as condition/result pairs, far cleaner than nesting four IFs. The final TRUE acts as the catch-all "else". (Classic nested form: =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","F"))).)
How to write IF step by step
- 1
Click the result cell and type =IF(
- 2
Write the condition to test, e.g. B2>=60, then a comma.
- 3
Type what to show when true (text in "quotes"), then a comma.
- 4
Type what to show when false, then close the bracket ) and press Enter.
- 5
For more than 2–3 outcomes, switch to IFS() instead of nesting IFs.
Common errors and fixes
| Error | Why it happens | How to fix it |
|---|---|---|
Too few / too many arguments | A comma or bracket is missing, or a nested IF is unbalanced. | Count your opening and closing brackets, and make sure each IF has exactly three parts. |
Result shows the formula as text | The cell is formatted as Text, or there is no leading equals sign. | Format the cell as General and re-enter the formula starting with =. |
Quotes missing around text | Text results like Pass were typed without quotes. | Wrap all text outputs in double quotes: "Pass". |
Frequently asked questions
How do I use IF with multiple conditions?
Combine conditions with AND() (all must be true) or OR() (any can be true) inside the logical test, e.g. =IF(AND(B2>=60, C2="Yes"), "Eligible", "No").
What is the limit on nested IFs?
Excel allows up to 64 nested IFs, but anything beyond 2–3 becomes unreadable. Use IFS() or SWITCH() instead for multiple outcomes.
IFS vs nested IF: which should I use?
IFS() is cleaner when you have several conditions because it lists them as simple pairs. Nested IF still works and is needed in older Excel versions that lack IFS.
Does the IF function work in Google Sheets?
Yes, IF, IFS, AND, and OR all work identically in Google Sheets.