Error Handling using IFERROR function in Excel

Excel IFERROR function

 

IFERROR function is used to captures and handles errors occurred while executing a formula.

 

IFERROR function returns specified value if the formula results in an error, otherwise it returns the result of the formula.

 

So, it works as a error handling step for your formula.. it shows a user friendly message rather than showing the error code.

 

Formula

 

=IFERROR(value, value_if_error)

 

Here,

 

  • value if the parameter is checked for an error.

 

  • value_if_error is 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!

 

Example 1:

 

In this example, we have price per unit and total price and we are supposed to find the number of units.

 

iferror function

 

Now, the no of units can be calculated as :

 

no of units = total price/price per unit

 

i.e. divide column B value with corresponding column A value

 

iferror function

 

But if there is any issues with the data or the formula, we will get errors like #DIV/0!, #NUM!, #NULL! etc.

 

So, to handle that, we can wrap the function using IFERROR as shown below:


iferror function

 

Now, for any errors during formula evaluation, we will get “Error Occurred” message in place of Error codes.

 

Notes :

 

  • 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.

 

 

You may also like the following posts on similar concepts :

 

IF function in Excel

 

Excel easy function reference

 

Excel Top 10 functions

 

 

© 2015, https:. All rights reserved. On republishing this post, you must provide link to original post

Leave a Reply.. code can be added in <code> </code> tags