IFERROR returns a value you choose when a formula results in an error, and it is the quickest way to show a blank instead of #DIV/0! for a product with no sales yet. Use it only where the error is expected; if you cannot explain an error, fix it first and do not hide it.
What you need
- Excel with the division column, such as a margin calculation
- A note of which rows can legitimately have a zero divisor
- A copy of the workbook
Step 1: Find the rows that divide by zero
Look at the column before wrapping anything: a zero divisor means a product with no sales yet, an empty cell, or a missing input. Only the first two are expected; a missing input should be entered, not hidden.
Step 2: Wrap the division with IFERROR
In the result column, enter =IFERROR(C2/B2,”) and fill it down. The two double quotes are an empty text string, so the cell looks blank while the other rows keep their normal results.
Step 3: Check the totals still work
Confirm the total row still divides total profit by total sales and is unchanged. A cell showing empty text is not empty: it holds text, so if later formulas do arithmetic on the column, return 0 instead of empty text.
Worked example: synthetic margin column
The table below is a synthetic example. It shows the expected result of handling #DIV/0!; no workbook was opened.
| Product | Margin | Result |
|---|---|---|
| Mugs | 40% | Normal result |
| Candles | Blank | No sales yet – #DIV/0! hidden |
| Tote bags | 35% | Normal result |
| Total margin | 38% | Unchanged |
Expected result (UNTESTED). Mugs shows 40% and Tote bags 35%, Candles shows a blank because it has no sales yet, and the total margin of 38% is unchanged. The expected errors are hidden and nothing else changed. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- IFERROR does not fix anything; it only changes what the cell shows.
- A blank from empty text holds text: SUM and AVERAGE skip it, but =D2+1 gives #VALUE!.
- For a division where you know the cause, =IF(B2=0,”,C2/B2) is clearer than IFERROR.
