Logical

IFERROR

Definition

IFERROR returns a fallback value when a formula results in an error, and the formula result otherwise.

Syntax

=IFERROR(value, value_if_error)

Arguments

Argument Meaning
value The formula to try, such as a divide.
value_if_error What to show instead when that formula returns an error. Text must sit in double quotes.

Worked example

A mill divides bags packed by hours worked. Bags are in A2:A4 and hours are in B2:B4.

A: Bags B: Hours
8 0
12 4
9 3

Formula: =IFERROR(A2/B2,"n/a")

Result: n/a. 8 divided by 0 is #DIV/0!, so IFERROR returns the fallback text. Filled down, the formula gives n/a, 3, and 3.

Practice

Cell A2 holds 10 and cell B2 holds 0. In C2, write a formula that divides A2 by B2 and returns 0 if that divide results in an error.

  1. In C2, write an IFERROR formula that divides A2 by B2 and shows 0 on error.
Step 1 of 2
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…

Related functions

IF can branch on a test you write yourself, and NOT can flip that test. IFERROR branches only on whether the inner formula errored.

Common mistake

Using IFERROR to hide every error, including a mistyped range: the fallback appears and the real mistake stays out of sight.

Related functions

These links are related functions.