Formualizer Docs

IFERROR

Returns a fallback when the first expression evaluates to any error.

IFERROR(value, value_if_error) is useful for user-friendly error handling.

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

=IFERROR(value, value_if_error)

Arguments

ArgumentTypeRequiredDefault
valueanyRequired—
value_if_erroranyRequired—

Remarks

  • Any error kind in the first argument triggers the fallback branch.
  • Non-error results pass through unchanged.
  • Evaluation failures surfaced as interpreter errors are also caught, except cancellation and resource-limit failures, which abort the evaluation request instead of selecting the fallback.
  • When the first argument is an array or range, each error element is replaced by the matching element of the fallback and other elements pass through. A scalar fallback applies to every error element; an array fallback is paired by position using the same broadcast rule as array operators (a single row or column repeats; other mismatched sizes return #VALUE!). Errors inside the fallback are returned as-is.
  • The fallback is evaluated at most once, and only when an error is present. An array or range with no error elements is returned unchanged, so a larger array fallback does not change the result's size.
  • A replaced array result larger than 16,777,216 cells, or larger than a sheet in either dimension, returns #NUM!.

Error cases

  • Exactly two arguments are required; other arities return #VALUE!.

Examples

Replace a missing-value error with a readable fallback.

Formula =IFERROR(NA(),"Unavailable")

Expected result Unavailable

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?.

Preserve a numeric input when there is no error to replace.

Formula =IFERROR(42,"Unavailable")

Expected result 42

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?.

A zero result is a valid value and does not need the fallback.

Formula =IFERROR(0,"Unavailable")

Expected result 0

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?.

An error in the fallback becomes the formula result.

Formula =IFERROR(NA(),1/0)

Expected result #DIV/0!

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?.

Replace division error

Formula =IFERROR(1/0, "n/a")

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?.

Pass through non-error

Formula =IFERROR(42, 0)

Expected result 42

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?.

Replace errors element by element

Formula =IFERROR(1/A1:A3, -1)

Input cells
A
11
20
32

Expected result {1; -1; 0.5}

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

Does IFERROR catch all error types?

An error produced while evaluating the first argument triggers the fallback. Dependency preparation, cancellation, and resource-limit failures abort the request instead of selecting the fallback.

How does IFERROR handle arrays?

Each error element of an array or range is replaced by the corresponding fallback element; clean arrays are returned unchanged without evaluating the fallback.

Implementation

Engine source

On this page