Sub topic 9
Reading #DIV/0!, #NAME?, and #VALUE!
This chapter explains the three errors you will meet most often when you write arithmetic formulas in Excel. You will learn what each error means, what usually causes it, how to find the cause, and how to fix it.
It assumes you can open a workbook, select a cell, type a value and press Enter, and write a formula that starts with =. It also assumes you know the operators +, -, *, /, ^ and %, and that you have seen cell references such as B2.
What an error value is
When Excel cannot calculate a formula, it does not leave the cell blank or guess. It shows an error value, a short code that starts with #. The code tells you the category of the problem. It does not always tell you which part of the formula is wrong, so you still need to inspect the formula.
Three things are worth knowing before you start:
- An error is a result, not a crash. The formula is still in the cell, and you can see and edit it in the formula bar.
- Errors spread. If
C2shows an error andD2has the formula=C2*2, thenD2shows the same error. The first cell in the chain is usually the one to fix. - Many errors are correct behavior. Excel is telling you that your data or formula asks for something impossible.
The table below summarizes the three errors in this chapter.
| Error | Meaning | Typical cause in arithmetic formulas |
|---|---|---|
| `#DIV/0!` | Division by zero | The divisor is `0`, or is an empty cell |
| `#NAME?` | Excel does not recognize a name or word | A typo, or text that is not in quotation marks |
| `#VALUE!` | A value is the wrong type | An arithmetic operator is applied to text that is not a number |
#DIV/0!: dividing by zero
Division by zero has no defined answer, so Excel returns #DIV/0!. Consider this formula:
=A2/B2If A2 holds 100 and B2 holds 4, the result is 25. If B2 holds 0, the result is #DIV/0!.
Empty cells count as zero
The case that surprises people is an empty divisor. In arithmetic, Excel treats an empty cell as 0. If B2 is empty, =A2/B2 also returns #DIV/0!.
This happens often when you build a sheet before the data arrives. The formulas are in place, the input cells are still empty, and the whole column shows errors. The formulas are not wrong. They are waiting for data.
Hidden zeros and other sources
The divisor does not have to be a cell you typed a zero into. Check these as well:
- The divisor is itself a formula that returns
0. For example,B2might contain=C2-D2, andC2andD2are equal. - The divisor is a value that displays as something else. A cell formatted to show no decimals might display
0when it really holds0.3, but that one does not cause an error. The reverse matters too: a cell that looks blank might contain a formula returning0with a number format that hides zeros. - The divisor is a whole expression in parentheses that evaluates to
0, as in=A2/(B2-C2).
To find out, click the divisor cell and read its content in the formula bar. The formula bar shows the real content, and the cell shows only the formatted display.
Fixing #DIV/0!
You have two choices. You can fix the data, or you can change the formula so it handles a zero divisor.
If the zero is a real mistake, fix the data. If a zero or empty divisor is expected, you can guard the formula with the IF function, which is covered later in the tutorial. For this chapter, a short preview is enough:
=IF(B2=0,"",A2/B2)This formula returns an empty text string when B2 is 0 or empty, and returns the division result otherwise. Note that the empty string is text, not a number. A later formula that does arithmetic on this cell will itself fail with #VALUE!, which is the third error in this chapter.
#NAME?: Excel does not recognize a word
Excel returns #NAME? when the formula contains text that Excel tries to read as a name, and no such name exists. A name can be a function name such as SUM, a named range you defined, or a table name.
In a first arithmetic formula, there are three common causes.
A typo in a function name
Suppose you type this:
=SUMM(B2:B5)SUMM is not a function, so Excel returns #NAME?. The correct function is SUM. This is the most common cause once you start using functions.
A cell reference with extra letters or a misplaced character
A cell reference is a column letter followed by a row number. If you type =B2*C or =B2*2C, Excel cannot read C or 2C as a reference or a number. Depending on the exact text, you may get #NAME? or Excel may refuse the formula and show a message instead.
Also check that references use the right form. =B2*(1+$F$1) works because $F$1 is a valid absolute reference. A version like =B2*(1+F$) is not valid.
Text without quotation marks
Text inside a formula must be in double quotation marks. Compare these:
=A2&" units"=A2&unitsThe first formula joins the value of A2 with the text units. In the second formula, Excel reads units as a name, finds no such name, and returns #NAME?.
The same rule applies to any word you type directly into a formula. If it is not a function, a reference, a number or a defined name, it needs quotation marks.
Finding the cause of #NAME?
Use this routine:
- Click the cell and look at the formula bar.
- Read every word in the formula that is not a number or a cell reference.
- For each word, ask: is it a real function name, a defined name, or text that needs quotation marks?
- Correct the spelling or add the quotation marks, then press Enter.
A useful hint: when you type a real function name, Excel shows a list of matching functions as you type. If the list does not appear for a function you expect to exist, check your spelling.
#VALUE!: the wrong kind of value
Excel returns #VALUE! when a formula uses a value of the wrong type. The usual case in arithmetic is applying +, -, *, / or ^ to text that Excel cannot read as a number.
Take the formula from the line-total example:
=B2*C2If B2 holds 4.50 and C2 holds 10, the result is 45. If C2 holds the word ten, Excel cannot multiply by it, so the result is #VALUE!.
Numbers stored as text
The harder case is a cell that looks like a number but is stored as text. This often happens when you import data, paste from a web page, or type an apostrophe before a number. Signs of this problem:
- The value is left-aligned in the cell, where numbers normally align to the right.
- A small green triangle appears in the corner of the cell.
- The formula bar shows the value with a leading apostrophe, or the cell format is set to Text.
Excel sometimes converts text that looks like a number during arithmetic. For example, ="5"*2 returns 10. But it does not do so for text that has extra characters, such as 5 kg, $5.00 USD, or a number with a non-breaking space. Those produce #VALUE!.
Spaces and invisible characters
A cell that appears empty is not always empty. If it contains a single space, Excel treats it as text. Then =A2+B2 returns #VALUE! when B2 contains only a space. A truly empty cell would be treated as 0 and the formula would work.
This is a good reason to check with the formula bar rather than the display. If you select the cell and see no content, press Delete to clear it fully.
Fixing #VALUE!
Choose the fix that matches the cause:
| Cause | Fix |
|---|---|
| A word where a number should be | Replace it with a number |
| A number stored as text | Retype the number, or use the green-triangle menu and choose Convert to Number |
| A unit or symbol typed with the number | Remove the extra characters, and show the unit through number formatting instead |
| A cell that holds only a space | Clear the cell with Delete |
| A formula that returns `""` used in later arithmetic | Return a number, or guard the later formula as well |
How errors spread through formulas
A formula that refers to a cell with an error produces the same error. This lets one bad input break many results. Consider this layout:
=B2*C2in D2, and then in E2:
=D2*(1+$F$1)If C2 holds text, D2 shows #VALUE!. Because E2 uses D2, E2 also shows #VALUE!, even though the formula in E2 is correct. If you only look at E2, you will search in the wrong place.
The rule is to trace back to the first error in the chain. The diagram shows this path.
A step-by-step diagnosis
When a cell shows an error, work through the same steps each time.
- Select the cell and read the formula in the formula bar.
- Read the error code and recall its category: division, unrecognized word, or wrong type.
- Check each cell the formula refers to. Click each one and read its real content in the formula bar.
- If a referenced cell also shows an error, move to that cell and start again there.
- Fix the first cell in the chain, press Enter, and confirm the errors downstream disappear.
Excel also helps. When you select a cell with an error, a small warning icon appears beside it. Its menu offers options such as Help on this error and Show Calculation Steps. The Show Calculation Steps option opens the Evaluate Formula dialog, which runs the formula one step at a time. This is the most direct way to see where a long formula fails.
You can also press F2 to edit the cell. While you edit, Excel outlines each referenced cell in a color that matches the reference in the formula. This makes it easy to see which cells the formula reads.
A worked example with all three errors
Suppose you have this small order sheet.
| Cell | Content |
|---|---|
| `A2` | `Pens` |
| `B2` | `2.50` |
| `C2` | `12` |
| `D2` | `=B2*C2` |
| `E2` | `=D2/F2` |
D2 returns 30. Now F2 is empty, so E2 shows #DIV/0!. You enter 3 in F2, and E2 returns 10.
Next, you copy a price from a web page into B3 and it arrives as $4.00 USD. The formula =B3*C3 in D3 returns #VALUE!, because $4.00 USD is text with extra characters. You retype the price as 4, and the formula works.
Finally, you edit D2 and mistype it as =B2*C2+TAXX. Excel reads TAXX as a name, finds none, and returns #NAME?. You remove +TAXX, or you define the missing value in a cell and refer to it by address, for example +$F$1. The error is gone.
In each case, the steps were the same: read the formula, name the error category, and inspect the inputs.
Common mistakes when fixing errors
- Fixing the formula that shows the error instead of the first cell in the chain.
- Trusting the display. A cell that looks blank or numeric may not be.
- Typing zeros into empty divisor cells just to make the error disappear. This produces a wrong result, not a right one:
=A2/B2withB2set to0is still an error, and with a fake value it is a wrong answer. - Wrapping every formula in a guard such as
IF(B2=0,"",...)by habit. This hides data problems and can cause#VALUE!in later formulas. - Forgetting quotation marks around text, which produces
#NAME?.
Summary of the diagnosis
#DIV/0! means a divisor is zero or empty. #NAME? means Excel found a word it does not recognize, usually a misspelling or text without quotation marks. #VALUE! means an operator received a value of the wrong type, usually text where a number should be. In all three cases, select the cell, read the formula bar, check the inputs one by one, and fix the first cell in the chain.
Exercise
Cell B2 is empty and cell A2 holds 50. The formula =A2/B2 returns #DIV/0!. Explain why, and describe two different ways to resolve it.
Show answer
Excel treats an empty cell as 0 in arithmetic, and dividing by 0 is undefined, so the result is #DIV/0!. You can resolve it by entering the correct nonzero value in B2, which fixes the data. Or you can guard the formula, for example =IF(B2=0,"",A2/B2), which returns an empty string while B2 is 0 or empty. The first fix corrects the cause, and the second hides the error until data arrives.
Exercise
A formula in E2 shows #VALUE!. It reads =D2*(1+$F$1). The formula itself is correct. Where should you look, and why?
Show answer
Look at D2 and F1, the cells the formula refers to. An error or a text value in either cell produces #VALUE! in E2. If D2 also shows an error, move to D2 and check its inputs in turn, until you reach the first cell in the chain. Fix that cell, and the errors downstream disappear.
Exercise
You type =A2&units and get #NAME?. What is wrong, and what is the corrected formula?
Show answer
Excel reads units as a name, and no such name exists. Text in a formula must be in double quotation marks. The corrected formula is =A2&"units", or =A2&" units" if you want a space before the text.