IFERROR Function
This function is used to trap errors in Excel formulas and return a meaningful message. It is like how errors are trapped and handled in computer code. IFERROR can trap the following error types: #VALUE!, #N/A, #DIV/0!, #REF!, #NAME?, #NUM!, or #NULL!.
Syntax
IFERROR(value, value_if_error)
Arguments
Argument
|
Description
|
Value
|
Required. This is the argument that is checked for an error. This can be a cell reference or a formula.
|
Value_if_error
|
Required. This is the value that is returned if the formula evaluates to an error.
|
Remarks
- If either value
or value_if_error
points to an empty cell, IFERROR treats it as an empty string value ("").
- If value
is an array formula, IFERROR returns an array of results, one for each cell in the results range.
Example
In the following example, we use the IFERROR formula to trap any errors in our formula in column C and return a text message “Calculation error”.
For the purpose of this exercise, the FORMULATEXT function has been used in D2:D5 to reveal the formulas in columns C2:C5.