## How to use the IFERROR function

The IFERROR function lets you catch most errors in Excel formulas. It was introduced in Excel 2007. In previous Excel versions, you could check for errors with the ISERROR function, it would return TRUE if the formula returned an error and FALSE if it was correct.

The IFERROR function makes it possible to create smaller formulas and still handle errors because the calculation is only needed once in the formula.

#### Table of Contents

- IFERROR function Syntax
- IFERROR function Arguments
- IFERROR function example
- What errors doesn't the IFERROR function catch?
- How to catch the #N/A Error?
- How to catch the #VALUE! error?
- How to catch the #REF Error?
- How to catch the #DIV/0 Error
- How to catch the #NUM Error
- How to catch the #NAME Error
- How to catch the #NULL Error
- How can I find all errors in a worksheet?
- IFERROR function simplifies finding errors in formulas
- Excel error functions
- Get Excel file

## 1. IFERROR Function Syntax

IFERROR(*value*, *value_if_error*)

## 2. IFERROR Function Arguments

value |
A cell reference or a formula to check for errors. |

value_if_error |
The value to return if the value argument evaluates to an error. The following error types are evaluated: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!. |

If the *value* argument returns an error, the *value_if_error *argument is used. If the *value* argument does NOT return an error, the IFERROR function returns the v*alue *argument.

## 3. IFERROR Function Example

Formula in cell D3:

The formula returns "Error" if cell B3 evaluates an error. Column C shows what the corresponding cell contains in column B.

## 4. What errors doesn't the IFERROR function catch?

The IFERROR function catches most errors except the #SPILL error and VBA errors in macros or UDFs.

Be careful using the IFERROR function, it will make it a lot harder to find errors in your worksheet that otherwise would be easy to spot.

## 5. How to catch the #N/A Error?

The image above shows a formula in cell B3 that returns a #N/A meaning "Value not available" error. The IFERROR function catches this error, however, if you want to detect exactly a #N/A error use the ISNA function or the IFNA function.

Formula in cell B2:

This error is returned if a value is not found using one of these functions: MATCH, VLOOKUP, LOOKUP, HLOOKUP and XLOOKUP etc. The MATCH function looks for an exact match using 0 (zero) as the lookup value and 1 as the lookup array, it can't find the value and returns "#N/A".

The formula in cell C2 returns "error" if the value argument returns an error, in this case, it does.

Formula in cell C2:

You can also reference a formula in another cell using the IFERROR function, this is demonstrated in cell D2.

Formula in cell D2:

Cell B2 returns "#N/A" error and that makes the formula in cell D2 return "Error".

How to correct a #N/A error? The function you are using can't find the value you are looking for, try another lookup value or check that you reference the correct lookup array.

## 6. How to catch the #VALUE! error?

The image above demonstrates a formula in cell B3 that returns the #VALUE! error. The formula tries to multiply a text string with a number, this mathematical operation is not valid.

Formula in cell B3:

How to correct the #VALUE! error? You have made a mistake when you built the function using arguments or one or more arguments are trying to do something that is not valid. For example. you perhaps are using text strings when the function only accepts numerical values.

Formula in cell C3:

The IFERROR function catches the #VALUE! error as well, cell C3 returns "Error".

The Formula in cell D3 references cell B3 and returns "Error" because cell B3 evaluates to an error.

## 7. How to catch the #REF Error?

The IFERROR function is able to catch #REF! errors, as well. The #REF! error is returned when you use an invalid cell reference.

Formula in cell B4:

The OFFSET function above tries to return a value from the row above cell A1 which is not possible. Excel returns a #REF! error.

Formula in cell C4:

How to correct the #REF! error? Often a cell reference is not valid, possibly been deleted or pointing to an incorrect location.

Formula in cell D4:

The ISREF function checks if a value is a cell reference.

## 8. How to catch the #DIV/0 Error

The image above shows a formula in cell B3 that returns #DIV/0! error, this happens a formula tries to divide a number with 0 (zero).

Dividing a number with zero is not possible: Division by zero (wikipedia)

Formula in cell B5:

The formula in cell B5 tries to divide 1 with 0 (zero), Excel returns the #DIV/0! error. How to correct a #DIV/0! error? Make sure that the divisor is not 0 (zero).

dividend/divisor = quotient

Formula in cell C5:

Formula in cell D5:

## 9. How to catch the #NUM Error

The image above shows a formula in cell B3 that returns a #NUM! error. You get this result when you use an invalid number.

Formula in cell B7:

The formula in cell B7 returns #NUM! error, the second argument is a negative number which is not allowed. You can only positive numbers in this argument.

How to correct a #NUM! error? Check your function arguments carefully.

Formula in cell C7:

Formula in cell D7:

## 10. How to catch the #NAME Error

The image above demonstrates a formula in cell B3 that returns #NAME! error.

Formula in cell B8:

The formula above tries to concatenate Text with 1 which is not possible.

How to correct a #NAME! error? There are many things that can be wrong here.

- Misspelled a named range.
- Misspelled a User Defined Function.
- Forgot to use double quotes before and after a text string.

Formula in cell C8:

Formula in cell D8:

## 11. How to catch the #NULL Error

You get the #NULL! error if you use an invalid cell reference in a formula or if you calculate the intersection of two cell ranges, however, they don't intersect.

Formula in cell B9:

This formula calculates the intersection of two cell references using the space character. It returns a #NULL! error because they don't intersect meaning they don't cross or overlap.

How to correct a #NULL! error? Check your cell references and make sure that intersecting cell ranges cross each other.

Formula in cell C9:

Formula in cell D9:

## 12. How can I find all errors in a worksheet?

Use the "Find & Replace" tool which is built-in to Excel, press short cut keys CTRL + F to launch it. A dialog box appears, enter the value you want to look for, in this example, #VALUE!

Press with left mouse button on "Options" button to see all settings. Change "Look in:" to Values, this is important or you won't find anything in your worksheet.

This method will, however, not catch errors inside the IFERROR function. As far as I know, you can't find those errors. I recommend that you use this method to locate all formulas using the IFERROR function and then, one by one, use the "Evaluate Formulas" tool to spot errors.

- Select the cell containing the IFERROR function.
- Go to tab "Formulas" on the ribbon.
- Press with left mouse button on the "Evaluate Formulas" button.
- Keep press with left mouse button oning the "Evaluate" button until you spot the error.
- Press with left mouse button on "Close" button to dismiss the dialog box.
- Repeat with the next cell.

## 13. IFERROR function simplifies formulas

**Example 1**

In previous Excel versions you could check for errors using the ISERROR function. This example shows both functions, the ISERROR function in cell C10 and IFERROR function in C12. The formula in cell C12 is much smaller.

**Formula in cell C10:**

**Formula in cell C13:**

**Example 2**

Here the price is missing for product A. The IFERROR function simplifies the formula in cell C13.

**Formula in cell C10:**

**Formula in cell C13:**

### 13.1 Explaining the formula in cell C12

#### Step 1 - Find a value and return corresponding value

INDEX(C3:C7,MATCH(C12,B3:B7,0))

becomes

INDEX(C3:C7,MATCH("A",{"A";"B";"C";"D";"E"},0))

becomes

INDEX(C3:C7, 1)

becomes

INDEX({0;2;4;2;3}, 1)

#### Step 2 - Divide 1 with the returned value

=IFERROR(1/(1/(INDEX(C3:C7,MATCH(C12,B3:B7,0)))),"Insert new price")

becomes

=IFERROR(1/(1/0)),"Insert new price")

becomes

=IFERROR(1/#DIV/0),"Insert new price")

becomes

=IFERROR(#DIV/0,"Insert new price")

and returns "Insert new price" in cell C13.

Back to top

### 'IFERROR' function examples

The following 91 articles contain the IFERROR function.

First, let me explain the difference between unique values and unique distinct values, it is important you know the difference […]

This post explains how to lookup a value and return multiple values. No array formula required.

Josh asks: now if i only knew how to apply these dependent dropdown selections to a filter, i'd be set. […]

Table of Contents AVERAGE ignore blanks Average - ignore blanks and errors Average - ignore blanks in non-contiguous cells Weighted […]

The AVERAGE function ignores empty cells, text values, and boolean values automatically, however, it doesn't handle error values. The AVERAGE […]

Rattan asks: In my workbook I have three worksheets; "Customer", "Vendor" and "Payment". In the Customer sheet I have a […]

Brad asks: I'm trying to use your formulas to create my own bill reminder sheet. I envision a workbook where […]

Question: List of data and blank cells in a column which will be added from day to day. There are […]

This article demonstrates formulas that calculate the number of cells between two values, the first scenario involves two search values […]

Question: How do I count how many times a word exists in a range of cells? It does not have […]

The image above shows a table with 3 columns containing random data. It is quite complicated trying to manually count […]

This article demonstrates a scoreboard, displayed to the left, that sorts contestants based on total scores and refreshes instantly each […]

Mark G asks: 1 - I see you could change the formula to have the experssion COUNTIF($C$1:C1, $E$2:$E$5)<5 changed so […]

This workbook contains two worksheets, one worksheet shows a calendar and the other worksheet is used to store events. The […]

The array formula in cell C2 extracts duplicate values from column A. Only one duplicate of each value is displayed […]

This webpage demonstrates formulas that merge three non-adjacent cell ranges. What's on this webpage Extract a list of duplicates from […]

The following regular formula extracts duplicates from column B (List1) and column D (List2) combined, the result is shown in […]

Question: How do I extract a unique distinct list from three ranges or lists? The ranges are not necessarily adjacent […]

Question: I have two ranges or lists (List1 and List2) from where I would like to extract a unique distinct […]

This article demonstrates ways to extract unique distinct sorted from A to Z ignoring blanks, and based on a condition. […]

This article demonstrates formulas that extract duplicate values from a column, however, column D contains values that you don't want […]

Table of Contents Extract the last word Extract the last letter Extract the last number Get Excel *.xlsx file 1. […]

This article presents methods for filtering rows in a dataset based on a start and end date. The image above […]

This article demonstrates an array formula that returns the table header based on a condition. For example, in cell C8 […]

In this post, I am going to show you how to extract unique distinct values and duplicates using a formula, […]

I read an article Merging Lists To A List Of Distinct Values at CPearson. The article describes code that you […]

The formula in cell B7 and C7 extracts whole weeks within the given date range in cell B3 and C3. […]

This article demonstrates formulas and Excel tools that extract duplicates based on three conditions. The first and second condition is […]

Sean asks: If Tea and Coffee has Americano,it will only return Americano once and not twice. I am looking for a […]

Table of Contents Filter unique distinct values based on a date range Filter unique distinct values based on a date […]

EEK asks: I am looking for the same formula on this page, but targeting a range of MxN (spanning multiple […]

This article explains how to extract values that exist in three different columns, they must occur in each of the […]

The image above shows a formula in cell D3 that extract dates from column B. Column B contains dates in […]

In my previous post, I described how to build a dynamic stock chart that lets you easily adjust the date […]

This template makes it easy for you to create a weekly school schedule, simply enter the time ranges and the […]

This formula returns multiple values even if they are arranged differently or have minor misspellings compared to the lookup value.

Column B contains document names, many of them are duplicates. The adjacent column C has the revision of the documents […]

A drop-down list in Excel prevents a user from entering an invalid value in a cell. Entering a value that […]

JD asks in this post: Dynamic team generator Hi, what if we have different number of people per team? So in […]

If you study a stock chart you will discover that sometimes significant trend reversals happen when a stock chart […]

The image above shows the COUNTBLANK function counting empty cells in cell range B3:B14. Note that the COUNTBLANK function ignores […]

Question: How do I create a unique distinct list where other columns meet two criteria using excel array formula? Answer: […]

Question: How do i remove common values between two lists? Answer: The solution in this article, removes common values and […]

This article describes a formula that returns all rows containing at least one digit 0 (zero) to 9. What's on […]

This article demonstrates two formulas, the first formula counts items by quarter and the second formula extracts the corresponding items […]

Question: How to identify two consecutive dates in a list? Answer: Array formula in cell B1: =IFERROR(LARGE(IF((A1+1)=$A$1:$A$30,A1+1,""),1),"") How to enter […]

The image above shows you a formula in cell D3 that tries to get the smallest number from cell range […]

Question: How do i create a flexible search formula to search a list? Answer: The following formula let´s you search […]

This article demonstrates how to insert and use a scroll bar (Form Control) in Excel. It allows the user to […]

Table of Contents Identify all characters in a cell value Identify all characters in a cell value - Excel 365 […]

Question: I want to find missing numbers in two ranges combined? They are not adjacent. Answer: Array formula in cell […]

This article demonstrates a formula that points out row numbers of records that overlap the current record based on a […]

This article demonstrates several ways to check if a cell contains any value based on a list. The first example […]

Question: How do i return multiple results for one lookup value? I have tried to use multiple vlookups, with no […]

HughMark asks: I have 2 columns named customer (A1) and OR No. (B1). Under customer are names enumerated below them. […]

This article demonstrates a formula that extracts unique distinct records/rows for a given month specified in cell C2, see the […]

This article demonstrates how to calculate dates in a given date range (cells B13 and B14) that don't overlap the […]

Today I'll show you a formula that returns a hyperlink pointing to a location based on a lookup value. When […]

This article demonstrates how to find a value in a column and concatenate corresponding values on the same row. The […]

This article demonstrates a formula that extracts items based on two conditions. The first condition (Location) is used to find […]

This article demonstrates a formula that allows you to search a data set using any number of conditions, however, one […]

Excel 2010 has a PowerPivot feature and DAX formulas that let you work with multiple tables of data. You can […]

The above image demonstrates a formula that adds values in three different columns into one column. Table of Contents Merge […]

The picture above shows how to merge two columns into one list using a formula. Table of Contents Merge two […]

This article demonstrates two formulas, they both accomplish the same thing. The Excel 365 formula is much smaller and is […]

This article demonstrates how to display buy and sell signals on an Excel chart based on two moving averages, the […]

I will in this article demonstrate a calendar that automatically highlights dates based on date ranges, the calendar populates names […]

This article demonstrates how to populate a drop down list with filtered values from an Excel defined Table. The animated […]

In this blog post I will provide two solutions on how to remove blank cells and a solution on how […]

This article demonstrates how to filter records occurring in only one out of two Excel defined tables. It also shows […]

Question: How do I identify rows that have a specific cell value in an Excel defined table? Array formula in […]

This article explains different techniques that filter rows/records that contain a given text string in any of the cell values […]

I will in this article demonstrate how to search a table for a date based on a condition and then […]

Geoff asks: Hi Oscar, I have a cross reference table we use for shift scheduling. The x-axis is comprised of […]

Andre asks:I am trying to list people with the highest scores based on certain criteria. My data: column A B […]

Table of Contents Sort text from two columns combined (array formula) How to create an array formula How to copy […]

This article demonstrates two ways to calculate expenses evenly split across multiple people. The first one is a formula solution, […]

This article demonstrates formulas and a UDF that searches for values in a table based on concatenated values and returns […]

Question: How do I divide values equally into groups (3 lists or less)? This post shows you two different approaches, […]

This blog article describes how to split strings in a cell with space as a delimiting character, like Text to […]

I have built a sheet to track time at work. It is very simple, there are 13 sheets, one for […]

This is follow up post to: Tracking a stock portfolio in excel (auto update) In this post we are going to […]

Question: I found a question here about tracking a stock portfolio. He would like to automatically create an overview table […]

Mark G asks in Create a random playlist in excel: Can this example be modified to create a true round-robin […]

The following formula performs a two-way lookup in two different tables.

I will in this article demonstrate how to use a value from a drop-down list and use it to do […]

This article demonstrates an array formula that searches two tables on two different sheets and returns multiple results. Sheet1 contains […]

This article demonstrates a formula that lets you extract non-empty values across columns based on a condition. The image above […]

This schedule uses the year and month in cell D1 and K1 to highlight activities like vacation specified in the […]

This article demonstrates three different ways to filter a data set if a value contains a specific string and if […]

I will in this article demonstrate four formulas that do lookups, extract unique distinct and duplicate values and sums numbers […]

## Functions in this article

### Functions in 'Logical' category

The IFERROR function function is one of many functions in the 'Logical' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form