Sub topic 9
A Cleaner Alternative: IFS
Assume you already know how to enter formulas, use cell references such as B2, and write basic IF formulas. In the previous chapter, you used nested IF functions when one test was not enough. Google Sheets provides IFS for the same kind of decision with a flatter, easier-to-read formula.
How IFS works
IFS checks several condition-and-result pairs from left to right. The first condition that evaluates to TRUE determines the result. Google Sheets then stops checking the remaining conditions.
The basic syntax is:
=IFS(condition1, result1, condition2, result2, condition3, result3)Each condition is a test, such as B2>=90. Each result is what the formula returns when that test is true.
Suppose column B contains test scores:
| Score | Grade |
|---|---|
| 85 | B |
Use this formula in the grade cell:
=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", TRUE, "F")For a score of 85, the first test is false. The second test is true, so the formula returns "B". It does not continue to the later tests.
Order matters
Because IFS uses the first true condition, put more specific or higher thresholds first. This formula is incorrect for letter grades:
=IFS(B2>=70, "C", B2>=80, "B", B2>=90, "A", TRUE, "F")A score of 95 meets B2>=70, so the formula returns "C" before it reaches the test for A. Arrange the conditions from highest score to lowest score instead.
You can also use IFS for categories that are not numeric:
=IFS(A2="Paid", "Done", A2="Pending", "Follow up", A2="Cancelled", "Closed", TRUE, "Review")Text comparisons use quoted strings. The comparison with = is not case-sensitive, so "paid" also matches "Paid".
Using TRUE as a default
An IFS formula returns #N/A if none of its conditions is true. Add TRUE as the final condition to provide a default result:
=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", TRUE, "F")The final TRUE condition always passes when the earlier tests fail. It works like the final false branch in an IF formula.
This default is useful when the input might be outside the expected ranges. For example, a status formula can return "Review" for an unexpected status instead of an error.
IFS compared with nested IF
These two formulas produce the same grades:
=IF(B2>=90, "A", IF(B2>=80, "B", IF(B2>=70, "C", "F")))=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", TRUE, "F")IFS is usually easier to scan because every condition is next to its result. Nested IF can still be useful when each branch needs a different calculation or when the logic must explicitly separate true and false branches.
Both approaches require careful ordering. Neither formula knows that score ranges are intended to be exclusive. Your conditions create those ranges.
Common errors
- Missing the default: Without a final fallback, unmatched input produces
#N/A. - Wrong order: A broad condition such as
B2>=50beforeB2>=80catches scores that should receive the higher category. - Unquoted text: Write
"Pass"and"Review"as text results. Without quotation marks, Sheets treats them as names or references. - Uneven pairs: Every condition must have a result. A missing result can cause a formula parse error.
- Mismatched parentheses: Check that the opening
IFS(has a closing).
A useful troubleshooting method is to test each condition in a separate cell. For example, enter =B2>=80. The result should be either TRUE or FALSE. This helps you separate a logic mistake from a syntax mistake.
Exercise
Write an IFS formula that returns "High" for values of 100 or more, "Medium" for values from 50 through 99, and "Low" for values below 50 in B2.
Show answer
=IFS(B2>=100, "High", B2>=50, "Medium", TRUE, "Low")