Various functions in Excel result in an error in certain situations. It’s annoying to look at them when the errors are unavoidable. In this article, you will learn how to handle such situations with the help of IFERROR function of Excel. The different types of errors that excel throws are: #NAME?, #REF!, #DIV/0!, #NULL!, #NUM!, #VALUE! And #N/A error.

All of you would be aware of the #N/A error which usually pops up when you are using VLOOKUP. Did you wonder how you could get rid of the error? Given that you know the error happens when the VLOOKUP can’t find the lookup value in the first column of the table array you have provided. Let’s see how we can use IFERROR to rectify the problem with the #N/A error.

Reasons why you’ll have to handle errors:

  • In some situations, you know that Excel can throw errors but not necessarily you have to correct them, however, errors are not very presentable, Something which makes more sense would be a good replacement for these errors.
  • When you use the cells that have errors in other functions like SUM or AVERAGE, the result might be an error just because one of the cells has an error
  • The end user who isn’t very familiar with Excel might get confused by the errors.

A quick recap of VLOOKUP formula:

VLOOKUP formula is used to lookup for a value in a table and based on the match fetch the result from other columns in the table. The syntax for VLOOKUP is as follows:

VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup])

lookup_value – The value that you want to search for.

table_array – The array of data that is to be searched for the lookup_value. Note: The Vlookup function searches in the left-most column of this array.

col_index_num – A number which specifies the column number of the supplied table_array, that you want to return a value from.

[range_lookup] – Optional.  FALSE is used for exact match and TRUE is used for approximate match

When we use exact match and if the formula is not able to find the given values the VLOOKUP formula results in #N/A error. In the next section, we’ll see how we can get rid of that using an example

Example: Handling #N/A error of VLOOKUP formula using IFERROR

  1. Create a table as shown below. Let’s say this represents the names of different people who played a game and their final scoresHandling errors using IFERROR
  2. Let’s use cell E1 to input the name that we use to lookup
  3. If we write a formula to look up the score of the name entered in E1, we use the formula: =VLOOKUP(E1,$A$2:$B$10,2,FALSE)
  4. Enter the above-mentioned formula in E2 as highlighted below:Handling errors using IFERROR 2
  5. You’ll notice that we are getting the result as 63 as we are searching for John.
  6. Let’s change the name to Shreyas. In this case, the formula results in an error as Shreyas is not available in the Table.
  7. Now, we’ll understand the usage of IFERROR. The syntax is as follows:

IFERROR(value, value_if_error)

Value is the argument that is checked for an error. Value_if_erroris the value to return if the formula evaluates to an error.

  1. In the example we have, we’ll use IFERROR on the result of VLOOKUP and show an appropriate message like “Name not found” when the result of VLOOKUP is an error
  2. In cell E3, enter the formula: =IFERROR(VLOOKUP(E1,$A$2:$B$10,2,FALSE),”Name not found”).
  3. Refer to the highlighted section in the screenshot below:Handling errors using IFERROR 3
  4. Now, instead of an error we are getting the message “Name not found”

This way IFERROR can be used to hide the known errors. To give better and more presentable results. As I’ve mentioned earlier, it can also hide #DIV/0!, #NAME?, #NULL!, #NUM!, #REF!, and #VALUE! You can download and refer to the solution file from the link below:

IF ERROR Example Solution File

Please share

Did you find this useful?  Why not share the love and tell your friends on the different social media platforms.

Get Free Email Updates!

Signup now and receive an email once I publish new content.

I agree to have my personal information transfered to ConvertKit ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Abdelrahman Abdou
Latest posts by Abdelrahman Abdou (see all)
It's only fair to share...Share on Facebook
Facebook
0Pin on Pinterest
Pinterest
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin