Fix the formula: Excel error practice, with answers
Six broken Excel formulas on one sheet: #DIV/0!, #N/A, #VALUE!, #NAME? and two wrong totals with no error at all. Why each breaks, and the fix.
Each exercise below starts with a formula that is broken. Your job is to say why, and to fix it. Four of them show an error value, so at least you know something is wrong. The last two show a number with no error at all. That number is wrong, and nothing on the sheet tells you.
Put this sales table in cells A3 to D8. Type the Units for Chain as '12, with the apostrophe in front. Excel then keeps it as text, not as a number. In F4, type P400 with a space after it.
Or download the sheet, ready to use: fix-the-formula-practice.xlsx. It opens in Excel with every table already in its cells.
| Row | A | B | C | D |
|---|---|---|---|---|
| 3 | Code | Product | Units | Revenue |
| 4 | P100 | Inner tube | 40 | 180 |
| 5 | P200 | Brake pad | 0 | 0 |
| 6 | P300 | Chain | 12 | 299.88 |
| 7 | P400 | Saddle | 6 | 231 |
| 8 | P500 | Brake cable | 20 | 135 |
Exercise 1 — #DIV/0!
In E5, somebody wants the revenue per unit for Brake pad. They typed
=D5/C5 and got #DIV/0!. Fix it so the cell is
empty when there are no units.
Why: C5 is 0, and nothing can be divided by 0.
Fix: =IF(C5=0,"",D5/C5) → an empty cell
The IF tests the units first and only divides when there is something to divide by. You may
see =IFERROR(D5/C5,0) → 0 instead. It works here, but it also
turns every other error into 0. A typo in the formula would show 0 and look fine.
Exercise 2 — #N/A when the code is there
In G4, =XLOOKUP(F4,A4:A8,D4:D8) gives #N/A. But
P400 is in the table. Fix it.
Why: F4 holds "P400 " with a space at the end. To Excel, that is a different code from "P400".
Fix: =XLOOKUP(TRIM(F4),A4:A8,D4:D8) → 231
TRIM removes spaces at the start and the end. Spaces like this usually come from data that was copied from a website or an email.
Exercise 3 — #VALUE! when joining text
In G6, somebody wants the words "Total: " in front of the revenue in D4. They typed
="Total: "+D4 and got #VALUE!. Fix it.
Why: + adds numbers. "Total: " is not a number, so Excel cannot add it.
Fix: ="Total: "&D4 → Total: 180
The & sign joins text. It turns the number into text and puts the two together.
Exercise 4 — #NAME?
In G8, =SUMM(D4:D8) gives #NAME?. Fix it.
Why: Excel has no function called SUMM. #NAME? means Excel does not know a word in the formula.
Fix: =SUM(D4:D8) → 845.88
The same error appears when text is typed without quotation marks, like =IF(A4=Chain,...) instead of =IF(A4="Chain",...). Excel reads Chain as a name it does not know.
Exercise 5 — a total that is too small
In C9, =SUM(C4:C8) gives 66. There is no error.
Add up the units yourself, and you get 78. Find out why, and fix it.
Why: C6 holds the text "12", not the number 12. SUM skips text without a
warning, so it adds 40 + 0 + 6 + 20 = 66. To check, type
=ISTEXT(C6) → TRUE.
Fix: make C6 a number. Type 12 again without the apostrophe. Or select the
cell, click the warning sign next to it, and choose Convert to Number. Then
=SUM(C4:C8) → 78.
Two signs give it away. The number sits on the left of the cell. And there is a small green triangle in its corner. Numbers like this often arrive in data from other systems.
Exercise 6 — an average that is too high
Before you fix C6, type =AVERAGE(C4:C8) in C10. It gives
16.5. What is wrong with it?
Why: AVERAGE also skips text. It divides 66 by 4 products, not 78 by 5. The answer looks reasonable, so nobody checks it.
Fix: the same as exercise 5. Once C6 is a number,
=AVERAGE(C4:C8) → 15.6.
The 0 for Brake pad is counted, and that is correct: zero units is a real value. An empty cell would not be counted.
Three broken sheets a formula cannot show
Some problems are not in one formula. Here are three you will meet. Try each one on the sales table.
- A circular reference. Type =SUM(D4:D9) in D9. The total now includes itself, and Excel shows a warning. Make the range stop one row above the total: =SUM(D4:D8).
- #SPILL! A formula that returns several values, like FILTER, needs empty cells below it. Type something in one of those cells and the formula shows #SPILL!. Clear the cells in its way.
- Formulas that do not update. You change a number, and the totals stay the same. The workbook may be set to manual calculation. Go to Formulas, then Calculation Options, and choose Automatic. Pressing F9 calculates once.
More about each error
Each error has its own page, with every cause we know: #N/A, #VALUE!, #REF! and #DIV/0!. For all of them in one place, read Excel error values explained.
Questions people ask
Should I wrap every formula in IFERROR?
No. IFERROR hides every error, including the ones that tell you a formula is wrong. Use it only where you expect one error and know which one. A lookup that may find nothing is an example. Even then, IFNA is safer for lookups, because it only hides #N/A.
Why is my number on the left of the cell?
Excel puts numbers on the right and text on the left. A number on the left is almost always a number stored as text, like C6 above. Exercise 5 shows how to fix it.