Formualizer Docs

IFS

Returns the value for the first TRUE condition in condition-value pairs.

IFS(cond1, value1, cond2, value2, ...) evaluates left to right and short-circuits.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=IFS(logical_test1, value_if_true1, [(logical_test2, value_if_true2), ...])

Arguments

ArgumentTypeRequiredDefault
logical_test1anyRequired—
value_if_true1anyRequired—
logical_test2anyOptional—
value_if_true2anyOptional—

Accepts a variable number of arguments. Minimum: 2.

Return type

Can return a reference when evaluated in a reference context.

Remarks

  • Conditions accept booleans and numbers (0 FALSE, non-zero TRUE); blank is FALSE.

Error cases

  • Arguments must be provided as pairs; odd argument counts return #VALUE!.
  • Text conditions return #VALUE!; error conditions propagate.
  • If no condition is TRUE, returns #N/A.

Examples

Return the result for the first true comparison in a sequence.

Formula =IFS(7>10,"High",7>5,"Medium")

Expected result Medium

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The first match takes precedence when multiple conditions are true.

Formula =IFS(7>5,"Medium",7>6,"High")

Expected result Medium

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Use one unconditional comparison, the minimum supported pair.

Formula =IFS(TRUE,"Default")

Expected result Default

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

With no true condition there is no result branch to return.

Formula =IFS(FALSE,"No match")

Expected result #N/A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

First matching condition wins

Formula =IFS(2<1, "a", 3>2, "b", TRUE, "c")

Expected result b

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

No conditions matched

Formula =IFS(FALSE, 1, 0, 2)

Expected result #N/A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

What errors can IFS return on structure issues?

Odd argument counts return #VALUE!, and no TRUE condition returns #N/A.

Implementation

Engine source

On this page