Excel IFERROR function

How to use the Excel IFERROR function


The Excel IFERROR function is a logical function to trap and handle errors in a formula. It returns a custom result if a formula generates an error, and returns the result of the formula if no error is detected. IFERROR is a great alternative to trap and handle errors without using complicated nested IF statements.


IFERROR( value, value_if_error )


value – The argument that is checked for an error

value_if_error – The value to return if an error is detected in the value argument

Return value

The value that has been specified for error conditions

How to use the IFERROR function in Excel

The IFERROR function detects errors in a formula and returns a custom result or formula if an error appears. It can catch and handle any error that potentially occurs in Excel calculations: #DIV/0!, #N/A, #VALUE!, #REF!, #NULL!, #NAME?, #NUM!.

A common error is the #DIV/0 error. It appears if a devision by zero is detected in a formula. To handle this error for a division of A1 by B1, use the following formula: 

= IFERROR(A1/B1, “Please enter a value different from 0 in B1”)

Another common error is the #N/A error.  This error often occurs for lookup functions like VLOOKUP if a no lookup value be found. To handle the error in this case, use the following formula:

= IFERROR(VLOOKUP(value, data, column, 0), “Lookup value not found!”)

For all other error types, the syntax is the exact same. 

Additional Notes

Be careful, if you provide no value for the value argument, it will be evaluated as an empty string (“”) and not an error. 

For the #N/A error type yo can also use the IFNA function. IFNA is specifically designed to only handle #N/A! errors.

AND formula examples

Related Tutorials

Related Functions

How to use the Excel IFNA function

Excel IFNA function

The Excel IFNA function is a logical function to trap and handle the #N/A error type in a formula. It returns a custom result for a #N/A error.

How to use the Excel IF function

Excel IF function

The Excel IF function allows you to perform a simple logical test and returns one value for a TRUE result, and another value for a FALSE result.