Logical checks and errors
SWITCH function: map exact status codes to readable labels
Evaluate a cell once against a list of exact code-to-label pairs, include a final default fallback for unexpected codes, and know when to use IFS instead.
Compact priority codes that need clear report labels
Maintenance exports store short codes—P1, P2, P3—in column A. Repeating A2="P1", A2="P2", A2="P3" inside nested IFs or IFS duplicates the cell reference on every branch.
| Code | Target response label |
|---|---|
| P1 | Immediate |
| P2 | Same day |
| P3 | Next business day |
| Any other code | Triage required |
Evaluate the expression once and end with a default value
SWITCH(expression, value1, result1, ..., [default]) evaluates A2 once and returns the result paired with the first matching value. Because the final argument ("Triage required") has no paired result after it, SWITCH uses it as the default fallback.
=SWITCH(A2,"P1","Immediate","P2","Same day","P3","Next business day","Triage required")Omitted default (#N/A), mixed case, and exact-match scope
Without that trailing default argument, an unexpected code like "P9" returns #N/A. Wrap messy imported codes with UPPER(A2) inside SWITCH so lowercase "p3" maps consistently everywhere. Keep SWITCH for exact equality matches; when rules test numeric ranges like Score >= 80, use IFS instead.
=SWITCH(UPPER(A2),"P1","Immediate","P2","Same day","P3","Next business day","Triage required")Try the example
Use the original values or change them to test your understanding.