Menu

#DIV/0! Error in Excel: How to Fix Divide by Zero

#DIV/0! appears when a formula divides by zero or by an empty cell, as in =B2/C2 with C2 empty. =IF(C2=0,"",B2/C2) shows a blank cell instead, and AVERAGE of a range with no numbers returns it too.

Every sheet on this page is live: change a number or a formula and it recalculates.

#DIV/0! appears when a formula divides by zero or by an empty cell (an empty cell counts as 0). =B2/C2 returns #DIV/0! while C2 is 0 or blank. =IF(C2=0,"",B2/C2) checks the divisor first and leaves the cell empty instead.

Sales per call
D3
ABCDE
1RepSalesCallsPer callPer call (checked)
2Ana1200403030
3Ben9000#DIV/0!
4Cy600#DIV/0!
5Dee750253030
#DIV/0! The formula divides by zero or by an empty cell.

D3 and D4 show #DIV/0!: Ben has 0 calls, and Cy's cell is empty. Column E shows 30 and 30 for Ana and Dee and nothing for the other two. Type a number into C4 and both columns fill in.

The error is often correct: dividing by zero has no answer, and here it means the data is not there yet. A blank or a 0 makes the sheet tidier, but decide which one is honest: AVERAGE counts a 0 and skips a blank "".

IF or IFERROR to fix #DIV/0!

Both formulas remove the error. They differ in what else they hide.

Checking the divisor vs catching every error
E5
ABCDE
1RepSalesCallsIF(C=0)IFERROR
2Ana1200403030
3Ben900000
4Cy60000
5Deen/a25#VALUE!0
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

For Ben and Cy both show 0. Dee's sales hold the text n/a, a data error: the IF version shows #VALUE! and points you at it, the IFERROR version shows 0 as if Dee had sold nothing. Use IF(C2=0,...) when zero is the only problem you expect, and IFERROR when any error should give the same fallback. The IFERROR page has more on this choice.

The check can also be written =IF(C2,B2/C2,0): a number other than 0 counts as TRUE. It is shorter and harder to read.

#DIV/0! with AVERAGE and AVERAGEIF

AVERAGE divides a sum by a count. With no numbers to count, it divides by zero.

Average for one rep
F2
ABCDEF
1RepSalesRepAverage
2Ana1200Dan#DIV/0!
3Ben900#DIV/0!
4Ana800
5Cy600
6Ben700
#DIV/0! The formula divides by zero or by an empty cell.

Dan has no sales rows, so AVERAGEIF in F2 has nothing to average. F3 averages the empty column C, with the same result. Change E2 to Ana and F2 shows 1000, the average of 1200 and 800. Two ways to handle the empty case in Excel:

=IFERROR(AVERAGEIF(A2:A6,E2,B2:B6),0)
=IF(COUNTIF(A2:A6,E2)=0,"no sales",AVERAGEIF(A2:A6,E2,B2:B6))

The second one says why the result is missing. AVERAGEIFS and a plain =SUM(B2:B6)/COUNT(B2:B6) behave the same way. See AVERAGEIF for its criteria.

#DIV/0! in a percent change

Percent change divides by the old value. When the old value is 0, there is no percentage that describes the change.

Change from last year
D4
ABCDE
1Product20252026ChangeChange (labelled)
2Desk20024020%20%
3Chair150120-20%-20%
4Lamp080#DIV/0!new
5Shelf90900%0%
#DIV/0! The formula divides by zero or by an empty cell.

The desk grew 20% and the chair fell 20%. The lamp sold nothing in 2025, so D4 is #DIV/0! and E4 says new. Text in a column of percentages stays text, so SUM and AVERAGE skip it. The percent change page covers the formula itself.

Fix an average that shows #DIV/0!

Average with no matching rows
F2
ABCDEF
1RepSalesRepAverage
2Ana1200Dan
3Ben900
4Ana800
5Cy600
6Ben700
Click a cell to see its formula. Change a number or a formula and the sheet recalculates.

Your turn: E2 holds a rep with no sales, so =AVERAGEIF(A2:A6,E2,B2:B6) returns #DIV/0!. Write a formula in F2 that returns the average sale of the rep in E2, or 0 when the rep has no sales.

Check also runs your formula with Ana in E2, so a formula that returns 0 without averaging fails. =IF(COUNTIF(A2:A6,E2)=0,0,AVERAGEIF(A2:A6,E2,B2:B6)) passes too.

Frequently Asked Questions

What does #DIV/0! mean in Excel?

The formula divided a number by zero, or by an empty cell, which Excel treats as zero. =B2/C2 returns #DIV/0! while C2 is 0 or blank. AVERAGE, AVERAGEIF and MOD return it too when they end up dividing by zero.

How do I make Excel show 0 instead of #DIV/0!?

Test the divisor first: =IF(C2=0,0,B2/C2). For a blank cell instead of 0, use =IF(C2=0,"",B2/C2). =IFERROR(B2/C2,0) is shorter but also turns every other error in the formula into 0.

Why does my total show #DIV/0!?

One of the cells it adds holds #DIV/0!, and SUM passes errors on. Fix the division in that cell with =IF(C2=0,"",B2/C2), or add around the errors with =AGGREGATE(9,6,D2:D10), which sums D2:D10 and skips error values.

Does an empty cell cause #DIV/0! in Excel?

Yes. A blank cell counts as 0 in a calculation, so =B2/C2 returns #DIV/0! while C2 is empty. =IF(C2=0,"",B2/C2) catches both a 0 and a blank, because an empty cell equals 0 in a comparison.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED