The Excel Iferror function receives two values (or expressions) and tests if the first of these evaluates to an error.
The syntax of the Iferror function is:
Where the arguments are:
value | - | The first value or expression that should be tested. |
value_if_error | - | The alternative value or expression, that is to be returned if the supplied value argument returns an error. |
Note: the Iferror function is new to Excel 2007, so is not available in earlier versions of Excel.
The following spreadsheet shows two simple examples of the Excel Iferror function.
Formulas:
|
|||||||||||||||
Results:
|
Note that:
In the following spreadsheet the Excel Iferror function is used with the Vlookup function.
If the Vlookup function successfully looks up a value, this is displayed in the cell; Otherwise, the text "not found" is displayed.
Formulas:
|
|||||||||||||||||||||||||||||||||||
Results:
|
For further information and examples of the Excel Iferror, see the Microsoft Office website.
Also, an example of using the Excel Iferror function to hide errors within conditional formatting is provided on the Microsoft Support website.