Sub topic 8
Choosing between IF, IFS, and SWITCH
Assume you can enter formulas, use cell references such as B2, compare values with operators such as >=, and use a basic IF formula. The three functions all choose a result, but they answer different questions.
Start with the shape of the decision
Use IF when you have one main test and two outcomes. Its structure is:
=IF(test, value_if_true, value_if_false)For example, this formula labels an order as urgent or normal:
=IF(C2="Urgent","Review now","Review later")Use IFS when you have several conditions that describe ranges or rules. It checks conditions from left to right and returns the value paired with the first condition that is TRUE.
=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"F")Use SWITCH when one expression should match one of several exact values. It is useful for codes, statuses, categories, or menu choices.
=SWITCH(A2,"NY","New York","CA","California","TX","Texas","Unknown")The final "Unknown" is the default result when A2 does not match any listed code.
| Function | Best for | How it decides |
|---|---|---|
| `IF` | One test with two branches | Tests one logical condition |
| `IFS` | Several rules or ranges | Tests conditions in order |
| `SWITCH` | Exact-value mapping | Matches one expression to cases |
Use IF for a simple two-way branch
Choose IF when the decision has only two meaningful paths. For example, a shipping rule might ask whether an order total is at least 50:
=IF(D2>=50,"Free shipping","Shipping fee applies")A nested IF can handle more paths, but each additional branch adds another opening and closing parenthesis:
=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C","F")))This works, but it becomes harder to read and edit as the number of rules grows. Prefer IFS when each branch is a separate condition.
Use IFS for ordered conditions
IFS is usually the clearest choice when conditions use comparisons such as >, >=, or <. The order matters because Sheets stops at the first true condition.
=IFS(B2>=70,"C",B2>=80,"B",B2>=90,"A",TRUE,"F")A score of 95 returns "C" here. The first condition, B2>=70, is already true, so Sheets never tests the later conditions. Put the most specific or highest threshold first.
A final TRUE condition acts as a catch-all fallback. Without it, an unmatched value returns #N/A. Use a fallback such as "Check score" when invalid or missing input is possible.
Use SWITCH for exact matches
SWITCH is clearer than a long chain of equality tests:
=SWITCH(C2,"Open","In progress","Closed","Finished","Pending","Waiting","Unknown status")This formula compares C2 with each case exactly. It does not naturally test ranges. For example, use IFS for score bands, but use SWITCH for fixed status names.
You can use SWITCH(TRUE, ...) to test conditions:
=SWITCH(TRUE,B2>=90,"A",B2>=80,"B",B2>=70,"C","F")This behaves like IFS, because each condition is evaluated in order. However, IFS communicates range-based logic more directly, so prefer SWITCH(TRUE, ...) when it fits an existing SWITCH pattern or when you need to mix condition results with other cases.
Exercise
Exercise
Which function should you use to return "Low", "Medium", or "High" based on whether B2 is below 10, from 10 through 19, or 20 and above? Write the formula.
Show answer
Use IFS because the decision uses ordered ranges: =IFS(B2>=20,"High",B2>=10,"Medium",TRUE,"Low")