SpreadsheetFormulas
error fixIFIFERROR

Fix the #DIV/0! Error

A rate, average, or percentage column shows #DIV/0! — usually in rows where the denominator hasn't been filled in yet.

Quick formula
=IF(B2=0,"",A2/B2)
Sample input
1RevenueUnitsPer Unit
2280014020.00
316000#DIV/0!
Result
1RevenueUnitsPer Unit
2280014020.00
316000 

Excel & Google Sheets

=IF(B2=0,"",A2/B2)

This formula works in both Excel and Google Sheets.

How it works

Dividing by zero is undefined, and spreadsheets treat an empty cell as zero — so any division whose denominator is blank or 0 returns #DIV/0!. The clean fix is to check the denominator before dividing: IF(B2=0,"",A2/B2) shows an empty cell when there's nothing valid to divide by, and the real result otherwise. This is better than blanket IFERROR, which would also hide genuinely broken numerators. The same error appears in AVERAGEIF when no rows match the condition — guard those with COUNTIF first or IFERROR deliberately.

B2=0
Checks the denominator. Blank cells count as 0, so this catches both.
""
What to show when division isn't possible — an empty cell. Use 0 or "–" if you prefer.
A2/B2
The real division, which now only runs when it's safe.

When to use it

Guard every division whose denominator comes from data entry — units sold, headcounts, response counts — since those columns inevitably have blank or zero rows.

Common mistakes

  • Returning 0 when division was impossible.

    A 0% rate and "no data yet" mean different things. Return "" or "–" so downstream averages aren't dragged down by fake zeros.

  • Using IFERROR instead of checking the denominator.

    IFERROR(A2/B2,"") also hides a #VALUE! from a text numerator. Guard the specific condition you expect: IF(B2=0,…).

Got a file full of these?

Open it in your browser — every error cell gets highlighted with its fix. Nothing is uploaded.

Open my spreadsheet

Did this formula help?

Engine-verified against the sample data aboveLast reviewed 2026-07-08