Ghost Sheet

#DIV/0! in Excel: handle the zero, don’t hide it with IFERROR

#DIV/0! means the formula divided by zero or by an empty cell.

This is the task for this topic. It is part of the plan; the level check before it is free.
D2=B2/C2

Click the sheet or the button: the task opens in your workspace, ready to type

ABCDE
1SKUTotal costQtyUnit cost
2TP-11072550
3BX-2041,947.595
4GL-31822040
5MK-4222,625125
6EN-53615015
7ST-64028595
8LB-754312.525
9FD-868357.555
10RB-9721,820140
11CL-18617510
12PN-29035050
13
14
15
16
17
18
19
20
21
dashed: the answer to reachblack: matchesblue: right after new datared: wrong

Wrapping it in IFERROR(…,0) makes the error disappear but turns “we have none” into “it costs nothing”. Test for the case you expect instead, =IF(C3=0,"no stock",B3/C3), and let other errors stay visible.

See it happen

StockD3=B3/C3
ABCD
1SKUStock valueUnitsCost per unit
2TP-1102501002.5
3BX-2043750#DIV/0!
4GL-318500#DIV/0!
Cost per unit is stock value divided by units. BX-204 sold out (0 units) and GL-318 was not counted (empty). Both rows show #DIV/0!.

Three ways to handle it

FormulaBX-204 showsWhat it tells the reader
=IFERROR(B3/C3,0)0That the item costs nothing. Wrong
=IF(C3=0,"no stock",B3/C3)no stockThe truth for a sold-out item
=IF(C3="","not counted",IF(C3=0,"no stock",B3/C3))no stock (filled down, GL-318 shows “not counted”)Separates “we have none” from “nobody counted”

An empty cell counts as zero in a comparison: filled down to row 4, =IF(C4=0,…) is true for GL-318 too. Test for the empty cell first if the difference matters.

Why not IFERROR?

Our view, not a rule from research: IFERROR catches every error, not only the one you expected. If a column is deleted or a lookup misses, IFERROR(…,0) turns those into zeros too, and the total below them still looks fine. A formula that names the case it expects keeps every other mistake visible. IFERROR is fine when you have checked that the only possible error is the one you mean.

The same idea applies to lookups: see VLOOKUP returns #N/A.

What Ghost Sheet doesn’t do

It does not scan your workbook for hidden errors. Its tasks run your formula on later data where the zero or the blank arrives, so you see what your choice does.

How we checked

We ran the formulas on this page on the example data in the formula engine Ghost Sheet uses (Univer) on November 24, 2026, except where the page says we could not, and the sheets show the values it returned. That engine is not Microsoft Excel, and we have not re-run these examples in desktop Excel. One known difference: where Excel shows TRUE or FALSE, our engine shows 1 or 0.

Updated