# IFERROR function

You can use the IFERROR function to trap and handle errors in a formula. IFERROR returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula.

## Syntax

IFERROR(value, value_if_error)

The IFERROR function syntax has the following arguments:

• value    Required. The argument that is checked for an error.

• value_if_error    Required. The value to return if the formula evaluates to an error. The following error types are evaluated: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!.

## Remarks

• If value or value_if_error is an empty cell, IFERROR treats it as an empty string value ("").

• If value is an array formula, IFERROR returns an array of results for each cell in the range specified in value. See the second example below.

## Examples

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter.

 Quota Units Sold 210 35 55 0 23 Formula Description Result =IFERROR(A2/B2, "Error in calculation") Checks for an error in the formula in the first argument (divide 210 by 35), finds no error, and then returns the results of the formula 6 =IFERROR(A3/B3, "Error in calculation") Checks for an error in the formula in the first argument (divide 55 by 0), finds a division by 0 error, and then returns value_if_error Error in calculation =IFERROR(A4/B4, "Error in calculation") Checks for an error in the formula in the first argument (divide "" by 23), finds no error, and then returns the results of the formula. 0

### Example 2

Quota

Units Sold

Ratio

210

35

6

55

0

Error in calculation

23

0

Formula

Description

Result

=C2

Checks for an error in the formula in the first argument in the first element of the array (A2/B2 or divide 210 by 35), finds no error, and then returns the result of the formula

6

=C3

Checks for an error in the formula in the first argument in the second element of the array (A3/B3 or divide 55 by 0), finds a division by 0 error, and then returns value_if_error

Error in calculation

=C4

Checks for an error in the formula in the first argument in the third element of the array (A4/B4 or divide "" by 23), finds no error, and then returns the result of the formula

0

Note: If you have a current version of Office 365, then you can input the formula in the top-left-cell of the output range, then press ENTER to confirm the formula as a dynamic array formula. Otherwise, the formula must be entered as a legacy array formula by first selecting the output range, input the formula in the top-left-cell of the output range, then press CTRL+SHIFT+ENTER to confirm it. Excel inserts curly brackets at the beginning and end of the formula for you. For more information on array formulas, see Guidelines and examples of array formulas.

## Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.