IFS
Return the result for the first condition that is true, without nesting.
Syntax
IFS(test1, value1, [test2, value2], ...) | Argument | Required | Description |
|---|---|---|
test1 | Required | The first condition to check. |
value1 | Required | What to return if it is true. |
test2 | Optional | Further condition/value pairs, checked in order. |
Examples
Every example below was executed against VisiGrid engine 0.31.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=IFS(A1>100,"huge",A1>5,"big",TRUE,"small") | big | The first true condition wins; later ones are not evaluated. |
=IFS(A1>100,"huge") | #N/A | No condition matched and there is no fallback, so #N/A. |
Order is the logic
IFS stops at the first true test, so conditions must run from most specific to
least. Writing A1>5 before A1>100 means nothing is ever huge — the broader
test catches everything first, and no error tells you.
Give it a fallback
With no matching condition the result is #N/A. The idiom is a final TRUE,
which always matches:
=IFS(A1>100, "huge", A1>5, "big", TRUE, "small")
That last pair is the else. Without it, a value that fits no branch produces
an error rather than a default, which is occasionally what you want and usually
not.
Excel compatibility
Matches Excel, including #N/A when nothing matches.