Formulas are the heart of Excel. They can do everything from basic math to complex data analysis. But sometimes, they don't work as expected. If you work in Excel a lot, you've probably seen many formula errors like #DIV/0, #NAME?, and #N/A. In fact, the more you work with formulas, the more errors you'll run into :)

Although formulas errors can be scary and frustrating, they are quite useful, because they tell you something is wrong. This is much better than *not knowing*. The most disastrous Excel problems come from *normal-looking* worksheets that quietly return *incorrect* results. Trust me, this is not the kind of problem you want to explain to your boss in a meeting.

Most formula errors are the result of small mistakes, like a typo, the wrong cell reference, or deleting a cell referred to by another formula. When you run into a formula error, don't panic. Stay calm and methodically investigate until you find the cause. Ask yourself, "What is this error telling me?" Experiment with trial and error. As you gain more experience, you'll be able to avoid many errors, and more quickly correct errors that do arise.

### Table of contents

- About Excel Formula Errors
- How to find formula errors
- How to fix formula errors
- How to trap errors
- Error-related Functions in Excel

### About Excel formula errors

There are 10 different formula errors you are likely to run into at some point as you work with Excel formulas. This section shows examples of each formula error, with information and links on how to correct the error.

### #DIV/0! error

As the name suggests, the #DIV/0! error appears when a formula tries to divide by zero, or by a value equivalent to zero. You may see a #DIV/0! error when data is not yet complete. For example, a cell in the worksheet is blank because data has not been entered, or is not yet available. You also may see the divide by zero error with the AVERAGEIF and AVERAGEIFS functions, when given criteria do not match any cells in the range. For example, in the worksheet below, the DIV error is displayed in cell D4 because C4 is empty. Empty cells are evaluated as zero by Excel, and B4 can't be divided by zero:

In many cases, empty cells or missing values are unavoidable. You can use the IFERROR function to trap the #DIV/0! and display a more friendly message if you like.

More: How to fix the #DIV/0! error

### #NAME? error

The #NAME? error indicates that Excel does not recognize something. This could be a function name misspelled, a named range that doesn't exist, or a cell reference entered incorrectly. For example, in the screen below, the VLOOKUP function in F3 is misspelled "VLOKUP". VLOKUP is not a valid name, so the formula returns #NAME?.

To fix a #NAME? error, you must find the problem, and then correct spelling or syntax. For more details and examples, see this page.

### #N/A error

The #N/A error appears when something can't be found. It tells you something is missing or misspelled. This could be a product code not yet available, an employee name misspelled, a color that doesn't exist, etc. Often, #N/A errors are caused by extra space characters, misspellings, or an incomplete lookup table. The functions most commonly affected by the #N/A error are classic lookup functions, including VLOOKUP, HLOOKUP, LOOKUP, and MATCH. For example, in the screen below, the formula in F3 returns #N/A because "Bacon" is not in the lookup table:

*If the value in E3 is changed to an existing value like "Coffee", "Eggs", etc. VLOOKUP will work normally and retrieve the item cost.*

The best way to prevent #N/A errors is to make sure lookup values and lookup tables are correct and complete. If necessary, you can trap the #N/A error with IFERROR or IFNA and display a more friendly message, or display nothing at all. '

More information: How to fix the #N/A error.

### #NUM! error

The #NUM! error occurs when a number is too large or small, or when a calculation is impossible. For example, if you try to calculate the square root of a negative number, you'll see a #NUM error:

*In the screen above the SQRT function is used to calculate the square root numbers in column B. The formula in C5 returns the #NUM! error because the value in B5 is negative, and it is not possible to compute the square root of a negative number.*

You might also run into the #NUM error if you reverse start and end dates inside the DATEDIF function. In general, fixing the #NUM! error is a matter of adjusting inputs as required to make a calculation possible again.

More information: How to fix the #NUM! error.

### #VALUE! error

The #VALUE! error appears when a value is not an expected or valid type (i.e. date, time, number, text, etc.) This can happen when a cell is left blank, when a text value is given to a function that expects a numeric value, or when dates are evaluated as text by Excel. For example, in the screen below, cell C3 contains the text "NA", and the formula in F2 returns the #VALUE! error.

Below, the MONTH function can't extract a month value from "apple", since "apple" is not a date:

Note: you may also see a #VALUE! error if you create an array formula and forget to enter the formula with Control + Shift + Enter.

To fix a #VALUE! error, you need to track down the problematic value and supply the right type of value. For more details and examples, see this page.

### #REF! error

The #REF! error is one of the most common errors you'll see in Excel formulas. It occurs when a reference becomes invalid. In many cases, this is because sheets, rows, or columns have been removed, or because a formula with relative references has been copied to a new location where references are invalid. For example, in the screen below, the formula in C8 was copied to E4. At this new location, since the range C3:C7 is relative, it becomes invalid and the formula returns #REF!:

#REF! errors can be somewhat tricky to fix because the original cell reference is gone forever. If you delete a row or column and then see #REF! errors, you should undo the action immediately and adjust the formulas first.

### #NULL! error

The #NULL! error is quite rare in Excel, and is usually the result of a typo where a space character is used instead of a comma (,) or colon (:) between two cell references. For example, in the screen below the formula in F3 returns the #NULL error:

Technically, this is because the space character is the "range intersect" operator and the #NULL! error is reporting that the two ranges (C3 and C7) do not intersect. In most cases, you can correct a NULL error by replacing a space with a comma or colon as needed.

More: How to fix the #NULL! error

### #### error

Although technically not an error, you may also see a formula that displays a string of hash characters (###) instead of a normal result. For example, in the screen below, the formula in C3 is adding 5 days to the date in column B:

In this case, the hash or pound characters (###) appear because the dates in column C are formatted with a long format and do not fit into the column. To fix this error, just make the column wider.

*Note: Excel won't display negative dates. If a formula returns a negative date value, Excel will display #####.*

More: How to fix ##### errors

### #SPILL! error

The #SPILL error occurs when a formula outputs a spill range that runs into a cell that already contains data. For example, in the screen below, the UNIQUE function is configured to extract a list of unique names into a spill range starting in D3. Because D5 contains "apple", the operation is stopped and the formula returns #SPILL!

When "apple" is deleted from D5, the formula will work normally, and return "Joe", "Sam", and "Mary".

Details: How to fix #SPILL errors

Video: Spilling and the spill range

### #CALC! error

The #CALC error occurs when a formula runs into a calculation error with an array. For example, in the screen below, the FILTER function is set up to filter the source data in B5:D11. However, the formula is asking for all data in the group "apple", which doesn't exist:

If the formula is adjusted to filter on group "A", the formula will work normally:

```
=FILTER(B5:D11,B5:B11="a")
```

### #BLOCKED! error

The #BLOCKED! error in Excel occurs when certain resources or functions are restricted. The error can occur when a required resource cannot be accessed or by issues such as Excel 4.0 (XLM) macros being disabled. For example, in the worksheet below, the defined name "sheetnames" is based on an older Excel 4.0 macro command called GET.WORKBOOK (details here). Because Excel 4.0 macros are disabled in the Trust Centered, Excel returns the #BLOCKED error.

To resolve this error in this particular case, Excel 4.0 macros must be enabled in the Trust Center and the file must be reopened. For a more complete explanation see List sheet names with a formula.

### Circular reference errors

A circular reference occurs when a formula refers directly to its own cell, or refers to another cell that depends on the original cell. This creates an infinite loop that cannot be resolved. For example, if cell A1 contains a formula that refers to B1, and B1 contains a formula that refers to A1, this creates a circular reference. Circular reference errors do not appear on the worksheet like other errors in Excel. To find circular references, navigate to Formulas > Error checking > Circular references. For more details see How to fix a circular reference error.

### How to find formula errors

There are three basic ways to find formula errors in Excel. The first way is simple observation. Because formula errors are displayed directly on the worksheet they are easy to spot in many worksheets. In larger worksheets or workbooks with many sheets, you can check for errors much faster with Excel's built-in tools. To select all errors on a given worksheet, you can use **Go To Special**. To generate a list of all errors in the entire workbook, you can use **Find and Replace**. Both options are explained below.

### Find errors with Go To Special

You can find all errors at once with Go To Special. Use the keyboard shortcut Control + G, then click the "Special" button. Excel will display the dialog with the options seen below. To select only errors, choose Formulas + Errors, then click "OK":

After you press OK, Excel will select all errors on the current worksheet. Once selected, you can use the Tab key to move through the selection one cell at a time. If no errors are present, Excel will return the message "No cells were found".

*Note: Go To Special will only find errors on the current worksheet. To find all errors in a workbook, see the next section below.*

### Find errors with Find and Replace

To find all errors in a workbook across multiple sheets, you can use Find and Replace:

- Open the Find and Replace dialog with the keyboard shortcut Control + F.
- In the "Find what" input area, input the characters "#*!" (without quotation marks).
- Next, select "Workbook" for "Within", and change "Look in" to "Values".
- Click the "Find All" button.
- Excel will display a list of matching errors in the workbook as seen below.

The asterisk (*) is a wildcard in Excel that will match any number of characters, so the idea here is to find values that start with a hash (#) and end with an exclamation point (!). Notice the list of errors contains multiple sheets. To navigate to each error, use the "Find Next" button or click a row in the list.

*Notes: (1) The search string "#*!" will not find a #N/A error, which does not end with an exclamation point (!). To find #N/A errors, use a more general search string like "#*" or a more specific string like "#N/A". (2) You can also enter individual errors directly. For example, you can enter "#N/A", "#DIV/0!", #REF!", etc. to find specific errors.*

### How to fix formula errors

The basic process for fixing formula errors looks like this:

- Find the errors (see above).
- Identify each error and understand its meaning.
- Trace the error back to its source. If this is difficult, try the trace error feature.
- Figure out what's causing the error. If needed, break the formula into parts.
- Fix the error at the source or trap the error.

Remember that formula errors often "cascade" through a worksheet, when one error triggers another. As you find and fix the core issue(s), things often come together quickly.

Video: Excel formula error examples

Video: Use F9 to debug a formula

### How to trap Errors

Trapping errors is a way of "catching" errors to stop them from appearing in the first place. This makes sense when you know certain errors are likely and you want to stop the errors from appearing on the worksheet. There are two basic approaches:

- Trap the error with IFERROR or ISERROR. With this approach, you are watching for an error, and providing an alternative value when an error is detected. This page shows a VLOOKUP example.
- Prevent calculation until required values are available. In this case, instead of watching for an error, you try to prevent the error from occurring by checking values first. This page shows several examples.

### Error-related functions in Excel

Excel provides several error-related functions, each with a different behavior. Click on the links below for more details:

- The ISERR function returns TRUE for any error type except the #N/A error.
- The ISERROR function returns TRUE for any error.
- The ISNA function returns TRUE for #N/A errors only.
- The ERROR.TYPE function returns the numeric code for a given error.
- The IFERROR function traps errors and provides an alternative result.
- The IFNA function traps #N/A errors only and provides an alternative result.