Start free

#DIV/0! error in Excel: what it means and how to fix it

Works in every version of Excel

Key takeaways

  • #DIV/0! means a formula divided by zero, and an empty cell counts as zero.
  • AVERAGE, AVERAGEIF and AVERAGEIFS show it when they have nothing to average.
  • Test the divisor with IF, such as =IF(C2=0,"",B2/C2), so only the zero case changes.
  • IFERROR also works, but it hides every other error in the formula too.
Jump straight to the practice sheet
On this page

#DIV/0! means a formula divided by zero. Nobody types =5/0 on purpose: the zero almost always comes from a cell, usually one that is empty. Excel counts an empty cell as zero in maths, so a rate, an average or a share copied down a column shows #DIV/0! on every row whose data hasn’t arrived yet. The fix is to decide what that row should show, and test for it.

1. Dividing by an empty cell or a zero

The sign-up rate is sign-ups divided by visits. Email’s rate works; the podcast hasn’t had any visits yet, so C3/B3 divides by an empty cell:

D3=C3/B3
RowABCD
1ChannelVisitsSign-upsRate
2Email400184.5%
3Podcast#DIV/0!

Test the divisor first, and only divide when it isn’t zero. An empty cell passes the test B3=0 too:

=IF(B3=0,0,C3/B3) → 0.0%

To leave the cell looking empty instead, return "": =IF(B3=0,"",C3/B3). Bear in mind that "" is text: a later formula that adds or multiplies that cell with + or * will show #VALUE!.

2. An average of nothing

AVERAGE adds up the numbers and divides by how many there are. With no numbers in the range, that count is zero. AVERAGEIF and AVERAGEIFS do the same when no row meets the condition. There are no North deals here:

E2=AVERAGEIF(A2:A4,D2,B2:B4)
RowABCDE
1RegionDealFindAverage
2East$1,200North#DIV/0!
3West$800
4East$1,500

Count the matches first, and average only when there are some:

=IF(COUNTIF(A2:A4,D2)=0,"No deals",AVERAGEIF(A2:A4,D2,B2:B4)) → No deals

3. MOD and QUOTIENT by zero

MOD returns the remainder after division, and QUOTIENT the whole-number part. Both divide, so both show #DIV/0! when the divisor is zero or empty. The same IF test fixes them: =IF(B2=0,0,MOD(A2,B2)).

Practise it: cost per sale, or “No sales”

Your task: In D2, work out the cost per sale: the spend in B2 divided by the sales in C2. When C2 is 0 or empty, show the text "No sales" instead.

Graded live
RowABCD
1CampaignSpendSalesCost per sale
2Spring$1,200.0048

Write the formula in the bar above, then press Check or Enter.

Hint

Divide B2 by C2, but test C2 with IF first: when C2=0 (an empty cell counts as 0), return "No sales".

Solution

=IF(C2=0,"No sales",B2/C2) Any formula that returns the same result passes.

IF or IFERROR?

IFERROR, as in =IFERROR(C3/B3,0), also returns 0 for the empty podcast row, and it’s shorter. But IFERROR catches every error, not only division by zero: if the visits cell held the text “n/a”, or the formula pointed at a deleted cell, IFERROR would still show 0 and you’d never know. The IF test changes only the case you meant. Use IFERROR when any error should give the same fallback, and you’ve checked the formula works.

Practise this in a lessonHide #DIV/0! with IFERRORA full exercise in the app's live grid, graded on what your formula calculates.Open the lesson

FAQ

What does #DIV/0! mean in Excel?

The formula divided a number by zero, or by a cell that is empty or holds 0. Dividing by zero has no answer, so Excel shows the error instead.

How do I show 0 or a blank instead of #DIV/0!?

Test the divisor first: =IF(C2=0,0,B2/C2) shows 0, and =IF(C2=0,"",B2/C2) leaves the cell looking empty.

Why does AVERAGE return #DIV/0!?

AVERAGE divides the total by how many numbers it found. If the range has no numbers, only blanks or text, it divides by zero. AVERAGEIF does the same when no row meets the condition.

IF or IFERROR for #DIV/0!?

IF, when you can. IFERROR(B2/C2,0) catches the zero, but it also turns a typo or a text value into 0, so you never see that the formula is broken.

Summarize this guide withChatGPTPerplexityClaude

Keep going

Guides that build on this one.

All guides
Errors & fixesPractice sheet

#NUM! error in Excel: what it means and how to fix it

#NUM! means a calculation has no valid answer: an IRR with no rate to find, a square root of a negative. Each cause and its fix, with a practice sheet.

2 min read · Updated
Errors & fixesPractice sheet

#NAME? error in Excel: what it means and how to fix it

#NAME? means Excel doesn't recognise a word in your formula: a misspelt function, text without quotes, a missing colon. Find it and fix it, with a practice sheet.

2 min read · Updated

Reading is step one. Writing the formula is the skill.

Practise in a live grid that grades what your formula calculates, with a specific hint when it's wrong.

Runs in your browser · Graded on your result · No install