Hello all. Let’s look at the IFERROR function in this tutorial. IFERROR function is used to trap errors and return a specific value for those error conditions. The function would trap the following errors: “#NA”, “#value!”, “#ref!”, “#div/0!”, “#num!”, “#Name?”, “#Null!”
Syntax: =iferror(value, value_if_error)
Here, the value can be a specific value or a reference or a formulae
As usual, let’s start with a simple example. In the below example, when C6/B6 is executed in D6, it would return “#div/0!” error.
Let’s look at how to trap this error and change it to a text like “invalid function” instead of “#div/0!”
Formula used would be: =Iferror(C6/B6, “invalid function”)
Let’s take another example of “#NA” error which is common in Vlookup function. When the lookup value is not found in the lookup table, the function would return “#NA”. Let’s look at an example:
In the above example, Emp# 999 is not available in the lookup table and hence it returned #NA. Let’s trap this error and replace with a text like “Emp ID not found in table”.
Formula would be: =Iferror(Vlookup(H3,B2:E9,4,0),”Emp# not found in table”)
Other pointers with regards to IFERROR function:
If you don’t need a specific text to be returned for errors, then value_if_error can just be “”
From Excel 2013+, IFNA function has been introduced to specifically handle NA error.
I hope you liked this section of the blog. Please provide us with your valuable feedback which would help in improving the content. Thanks for reading.