Sub topic 4
IFS order and a TRUE fallback
Assume you can enter formulas in Google Sheets, use cell references such as B2, compare values with operators such as >=, and write a basic IF formula. In this chapter, you will use IFS to test several conditions in sequence.
How IFS evaluates conditions
IFS takes pairs of arguments:
=IFS(condition1, result1, condition2, result2, ...)A condition is a test that returns either TRUE or FALSE. Google Sheets checks the conditions from left to right. It returns the result paired with the first condition that is TRUE, then stops checking.
Suppose B2 contains a test score:
=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"F")The formula checks for an A first. If that test is false, it checks for a B, then a C. The final TRUE matches any remaining value, so scores below 70 receive an F.
The order is important because conditions can overlap. A score of 95 is also greater than 80 and 70, but the first condition, B2>=90, should decide the result.
Why condition order changes the result
This formula puts the broadest condition first:
=IFS(B2>=70,"C",B2>=80,"B",B2>=90,"A",TRUE,"F")With a score of 95, B2>=70 is already TRUE, so the formula returns "C". It never reaches the B or A tests.
For descending thresholds, put the strictest condition first:
=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"F")You can also design conditions that do not overlap. For example, this formula makes each range explicit:
=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",B2<70,"F")A final TRUE is usually easier to maintain because it catches every value not matched earlier.
Adding a TRUE fallback
Without a fallback, IFS returns #N/A when no condition is true:
=IFS(B2>=90,"A",B2>=80,"B")A score of 75 matches neither condition, so the result is #N/A. Add TRUE as the last condition and provide the result immediately after it:
=IFS(B2>=90,"A",B2>=80,"B",TRUE,"Below B")TRUE is a Boolean value, meaning a value that is always true. Because it appears last, it acts as the default branch. Earlier conditions still get priority.
| Formula part | Purpose |
|---|---|
| `B2>=90,"A"` | Returns A when the score is at least 90 |
| `TRUE,"Below B"` | Returns Below B when no earlier test matched |
Checking the input separately
A fallback does not replace input validation. If a score cell contains text, an unexpected value, or a missing value, decide what your sheet should display. You can wrap the formula with IFERROR when the calculation itself might produce an error:
=IFERROR(IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"F"),"Check score")Use this carefully. It can provide a clear message, but it can also hide a misspelled function or a broken reference. First make sure the conditions and cell references are correct.
Exercise
What result does =IFS(B2>=70,"C",B2>=80,"B",TRUE,"F") return when B2 contains 85, and how should you fix the formula for normal letter grades?
Show answer
It returns C because the first condition is already TRUE. Put B2>=80 before B2>=70, and add the higher threshold first if A is also required.