Sub topic 7
SWITCH(TRUE, ...) as an alternative to IFS
Prerequisites
You should know how to enter Google Sheets formulas, use cell references such as B2, compare values with operators such as >=, and write basic IF formulas. You should also understand that a formula can return different results based on a condition.
How `SWITCH(TRUE, ...)` works
SWITCH normally compares one expression with a list of exact values. For example, this formula maps a state abbreviation to a full name:
=SWITCH(A2,"NY","New York","CA","California","TX","Texas","Unknown")The first argument, A2, is the expression. Google Sheets compares it with each case value: "NY", "CA", and "TX". The final "Unknown" is the default result when no case matches.
SWITCH(TRUE, ...) changes this pattern. Each case value becomes a condition, such as B2>=90. A comparison produces either TRUE or FALSE. Because the first argument is also TRUE, SWITCH returns the result paired with the first condition that evaluates to TRUE.
=SWITCH(TRUE,B2>=90,"A",B2>=80,"B",B2>=70,"C","F")If B2 contains 84, the conditions are evaluated in order:
B2>=90isFALSE.B2>=80isTRUE."B"is returned, and later conditions are not used.
The final "F" is the default. It handles scores below 70.
Why condition order matters
SWITCH stops at the first matching case. Put the most specific or highest-priority conditions first. With score ranges, test the highest threshold first:
=SWITCH(TRUE,B2>=70,"C",B2>=80,"B",B2>=90,"A","F")This formula returns "C" for a score of 95. The condition B2>=70 is already true, so Google Sheets never reaches the test for 80 or 90.
The behavior is similar to IFS: both functions evaluate conditions from left to right. Both require careful ordering when conditions overlap. The difference is that IFS directly accepts condition-and-result pairs, while SWITCH(TRUE, ...) uses TRUE as a matching expression.
Visual model
When to use this pattern
Use SWITCH(TRUE, ...) when:
- You want conditions and results in one readable sequence.
- You already use
SWITCHfor exact-value mapping. - A decision has several ordered tests.
- You need a default result for every unmatched case.
Use IFS when the formula is mainly a list of condition-and-result pairs. IFS communicates that purpose more directly:
=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",TRUE,"F")Use ordinary SWITCH when you are matching one expression to exact values, such as status codes or department names. Use IF for a simple two-way decision.
SWITCH(TRUE, ...) is an alternative, not a requirement. Choose it when its structure makes the conditions easier for your team to scan and maintain.
Exercise
Write a formula that returns "High" when C2 is at least 100, "Medium" when C2 is at least 50, and "Low" for every other value.
Show answer
=SWITCH(TRUE,C2>=100,"High",C2>=50,"Medium","Low")