Sub topic 1
What an Excel error value tells you
When a formula fails, Excel doesn't leave the cell empty or show a vague warning. It stores a specific error value in the cell, such as #DIV/0! or #N/A. Each one names a category of failure. Reading the error correctly cuts the search for the cause from "something is wrong" to a short list of likely suspects. This chapter covers what error values are, how they behave, and how to read them. The later chapters fix each one in detail.
Prerequisites
This chapter assumes you can:
- Enter and edit formulas in a worksheet.
- Use cell references and ranges such as
A2andA2:A10. - Use basic functions such as
SUM,AVERAGEandVLOOKUP. - Tell numbers from text in a cell. Numbers align right by default and text aligns left.
Error values are results, not alerts
An error value is the result of a formula, in the same way that 42 or "Paid" is a result. Excel stores it in the cell, and other formulas can read it. This has two consequences:
- The error appears in the cell that holds the failing formula. The cause may be in a different cell, or in a cell that formula depends on.
- Formulas that use an error value usually return the same error.
All the classic errors start with #. Most end with ! or ?, but #N/A does not.
The common error values
| Error | Typical meaning | Typical cause |
|---|---|---|
| `#DIV/0!` | Division by zero | The divisor is 0 or an empty cell |
| `#VALUE!` | Wrong type of value | Text where a number is needed, or mismatched arguments |
| `#REF!` | Invalid reference | A referenced cell, row or column was deleted |
| `#NAME?` | Unrecognized name | A misspelled function or an undefined name |
| `#N/A` | Value not available | A lookup found no match |
| `#NUM!` | Invalid number | An impossible calculation, such as the square root of a negative number |
| `#NULL!` | Empty intersection | A space used where a comma or colon was meant |
| `#SPILL!` | Blocked spill range | A dynamic array formula has no room for its results |
Newer versions of Excel add errors for dynamic arrays and data types, such as #CALC! and #FIELD!. The table above covers the ones you will meet most often.
Reading an error as a clue
Each error points at a different part of the formula:
#DIV/0!,#NUM!and#VALUE!point at the values being calculated. Check the data feeding the formula.#REF!,#NAME?and#NULL!point at the formula's own text. Something in how the formula is written is broken.#N/Apoints at a lookup or a missing input. Often the formula is working as designed and the data it searched has no match.#SPILL!points at the worksheet around the formula, not the formula itself.
Errors spread through dependent formulas
Suppose a small worksheet calculates revenue per unit and then applies a tax uplift.
| Cell | Formula | Result when B2 is 0 |
|---|---|---|
| C2 | `=A2/B2` | `#DIV/0!` |
| D2 | `=C2*1.2` | `#DIV/0!` |
| D10 | `=SUM(D2:D9)` | `#DIV/0!` |
The only broken formula is in C2. Because D2 uses C2, it returns the same error. Because SUM adds up a range that contains an error, the total in D10 fails too. One bad cell can turn a whole report into errors.
When you see a column of identical errors, don't fix them one by one. Trace back to the earliest cell that shows the error, where the error first appears, and fix that cell.
Some functions handle errors differently
Most functions return an error if any cell they read contains one. A few don't, and the difference matters when you debug.
=SUM(A2,B2)If B2 holds the text "n/a", this formula still works, because SUM ignores text in cell references. The formula =A2+B2 returns #VALUE! with the same inputs. If B2 holds an error value, both formulas return that error.
AGGREGATE can skip errors in a range. This formula sums D2:D9 and ignores any error values:
=AGGREGATE(9,6,D2:D9)The first argument, 9, selects the sum function. The second, 6, tells Excel to ignore error values. This gives you a number, but it also hides the failing cells, so use it knowingly. The last chapter of this tutorial covers preventing errors versus masking them.
Identifying an error in a formula
You can test for errors in a formula instead of reading them by eye. Three functions are the building blocks:
ISERROR(value)returnsTRUEfor any error value.ISNA(value)returnsTRUEonly for#N/A.ERROR.TYPE(value)returns a number that identifies the error.
ERROR.TYPE is useful when a sheet has many errors and you want to count or sort them by kind:
=ERROR.TYPE(C2)| Error | `ERROR.TYPE` result |
|---|---|
| `#NULL!` | 1 |
| `#DIV/0!` | 2 |
| `#VALUE!` | 3 |
| `#REF!` | 4 |
| `#NAME?` | 5 |
| `#NUM!` | 6 |
| `#N/A` | 7 |
| `#SPILL!` | 9 |
| `#CALC!` | 14 |
If the cell holds no error, ERROR.TYPE itself returns #N/A. Wrap it in another function if you need a clean result for every row. The chapter on IF, IFERROR and IFNA shows how.
The error indicator and the cell value
When a cell has a formula problem, Excel often draws a small green triangle in its top-left corner. Select the cell and a warning icon appears next to it. Its menu names the problem and offers actions, such as getting help on the error, showing calculation steps, or ignoring the error. The next chapters on reading the indicator and on debugging tools cover this menu.
Two cautions apply:
- A cell can show an error value without a green triangle, and a cell can have a green triangle without showing an error value. For example, a number stored as text gets a triangle but displays normally. The triangle is a warning from Excel's checking rules. The error value is the actual result of the formula.
- Excel only flags what its rules can detect. A formula that returns a wrong number with no error is not flagged at all. Errors are the visible part of formula problems, not the whole of them.
A habit for reading errors
When a cell shows an error, work through the same short sequence each time:
- Read the error text and match it to a category in the table above.
- Click the cell and read the formula in the formula bar.
- If the formula uses other cells, check whether they contain errors too. If so, move to the earliest one.
- Check the inputs: types of value, blanks, spaces and deleted references.
- Fix the cause, then confirm that the dependent cells recover.
Exercise
Cell E2 contains =D2*1.2 and shows #DIV/0!. Cell D2 contains =B2/C2, and C2 is empty. Which cell has the formula that needs attention, and why does E2 show the error?
Show answer
D2 needs attention. Dividing by the empty cell C2 gives #DIV/0!, because an empty cell counts as zero in division. E2 shows the same error only because it uses D2, so fixing D2 (for example by entering a value in C2 or testing C2 before dividing) clears E2 as well.
Exercise
B2 contains the text "n/a". What does =A2+B2 return, what does =SUM(A2,B2) return, and why do they differ?
Show answer
=A2+B2 returns #VALUE!, because the + operator tries to treat the text "n/a" as a number and fails. =SUM(A2,B2) returns the value of A2, because SUM ignores text in cell references.
Exercise
Which error type would =ERROR.TYPE(A2) report as 7, and what happens if A2 contains no error?
Show answer
It reports #N/A. If A2 contains no error, ERROR.TYPE itself returns #N/A.