Excel errors

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

Fix #DIV/0! in Excel: zero or empty divisors, AVERAGEIF with no matches, growth from zero, STDEV.S on one value, pivot tables. Every cause with a fix.

#DIV/0! means "division by zero". Some formula divided a number by 0, or by an empty cell, which Excel treats as 0. Mathematically there is no answer, so Excel refuses to invent one. The error is easy to understand but appears in surprising places: averages of empty lists, growth rates from a zero base, standard deviations of a single value. It also shows up constantly in templates that are not filled in yet, which is where most people first meet it. Below is every common cause with a sheet that reproduces it and the fix, plus advice on when hiding the error is fine and when it misleads. For all error values see Formula errors: what each one means and how to fix it.

What #DIV/0! means

A cell shows #DIV/0! when the / operator, or a function that divides internally, ends up with a divisor of zero. Empty cells count as 0 in arithmetic, so dividing by a blank cell gives the same error. Functions that divide behind the scenes include AVERAGE, AVERAGEIF, AVERAGEIFS, STDEV.S, VAR.S, MOD and QUOTIENT. Like every error, #DIV/0! spreads to any formula that uses the cell.

Cause 1: the divisor is zero

Average order value is revenue divided by number of orders. A sales rep who has not closed any orders yet has 0 in the Orders column:

D3fx=B3/C3
ABCD
1RepRevenueOrdersAvg order
2Anna1840023800
3Bruno00#DIV/0!
4Chen15900121325

Bruno has no orders, so 0 ÷ 0 has no answer.

Result: #DIV/0!

Fix. Decide what the sheet should show when there is nothing to divide by, and test the divisor directly:

D3fx=IF(C3=0, "", B3/C3)
ABCD
1RepRevenueOrdersAvg order
2Anna1840023800
3Bruno00
4Chen15900121325

An empty result for Bruno; Anna (18,400 ÷ 23 = 800) and Chen (15,900 ÷ 12 = 1,325) are unchanged.

Result:

Showing an empty cell, a dash or "no orders" is clearer than 0, because an average order value of 0 is not true: there were no orders to average. Testing C3=0 is better than wrapping the formula in IFERROR, because it handles exactly this case and nothing else.

Cause 2: the divisor is an empty cell

Templates are full of formulas waiting for data. A margin column calculates (Revenue - Cost) / Revenue, and for months that have not happened yet Revenue is blank:

D3fx=(B3-C3)/B3
ABCD
1MonthRevenueCostMargin
2Jan420003150025.0%
3Feb#DIV/0!

B3 is empty, which counts as 0. January's margin is (42,000 - 31,500) ÷ 42,000 = 25.0% (formatted as a %).

Result: #DIV/0!

Fix. Leave the result empty until the input exists: =IF(B3="", "", (B3-C3)/B3). Testing B3="" treats a genuine zero differently from a missing value; use B3=0 if both should give a blank. A template full of #DIV/0! looks broken to the people who receive it, so this small guard is worth adding everywhere.

Cause 3: AVERAGE or AVERAGEIF with nothing to average

An average is a sum divided by a count. If the count is zero, because the range is empty, holds only text, or no row meets the condition, the result is #DIV/0!.

E2fx=AVERAGEIF(A2:A4, "West", C2:C4)
ABCDE
1RegionRepSalesWest avg
2NorthAna500#DIV/0!
3SouthBen300
4NorthChen250

No rows are in the West region, so there is nothing to average.

Result: #DIV/0!

E2fx=IF(COUNTIF(A2:A4, "West")=0, "No sales", AVERAGEIF(A2:A4, "West", C2:C4))
ABCDE
1RegionRepSalesWest avg
2NorthAna500No sales
3SouthBen300
4NorthChen250

COUNTIF checks that there is at least one row before averaging.

Result: No sales

The same applies to =AVERAGE(B2:B10) on an empty column and to AVERAGEIFS. In Microsoft 365 a FILTER-based average such as =AVERAGE(FILTER(C2:C4, A2:A4="West")) returns #CALC! instead, because FILTER fails first (#CALC! error in Excel: causes and how to fix it).

Cause 4: percentage change from a zero base

Growth is (New - Old) / Old. A product that did not exist last year has an old value of 0, and the growth rate is undefined.

D3fx=(C3-B3)/B3
ABCD
1Product20252026Change
2Lamps120001500025.0%
3Rugs08000#DIV/0!

Rugs were launched in 2026, so there is no base to compare with. Lamps grew (15,000 - 12,000) ÷ 12,000 = 25.0%.

Result: #DIV/0!

D3fx=IF(B3=0, "New", (C3-B3)/B3)
ABCD
1Product20252026Change
2Lamps120001500025.0%
3Rugs08000New

Label the row instead of pretending the growth is 0% or 100%.

Result: New

Resist the temptation to show 100%. Growth from zero is not 100%; it is not defined. A text label such as "New" is honest and stays out of any average of growth rates.

Cause 5: statistics on too little data

  • =STDEV.S(B2:B2) (one value) returns #DIV/0!, because the sample formula divides by n - 1 = 0. The same goes for VAR.S, STDEV and VAR. Use STDEV.P if the data is the whole population, or wait for at least two values.
  • =MOD(A2, 0) and =QUOTIENT(A2, 0) return #DIV/0!, for example when a "split into groups of N" input is left empty.
  • SLOPE, CORREL and RSQ return #DIV/0! when all x values are the same, since there is no spread to divide by.
  • Ratios built from other formulas: if Orders is itself a COUNTIFS that finds nothing, every ratio using it fails.
D2fx=STDEV.S(B2:B2)
ABCD
1TestScoreStd dev
2Quiz 178#DIV/0!

A sample standard deviation needs at least two values.

Result: #DIV/0!

Cause 6: pivot tables and calculated fields

A calculated field such as =Profit/Revenue in a pivot table shows #DIV/0! for any item whose revenue is 0. You cannot wrap pivot cells in IF, so use the built-in option instead: right-click the pivot, PivotTable Options › Layout & Format, tick For error values show and type a dash or leave it empty. See PivotTables: summarise thousands of rows in seconds.

Note. Dividing by a cell that contains an empty text "" (for example the result of =IF(x, "", ...)) returns #VALUE!, not #DIV/0!, because the divisor is text rather than zero. See #VALUE! error in Excel: causes and how to fix it.

How to find every #DIV/0! in a workbook

  1. Go To Special. Press F5 or Ctrl+G (the same on a Mac), click Special, choose Formulas and leave only Errors ticked, then OK. Excel selects every formula on the sheet that shows an error, of any kind. Give the selection a fill colour so the cells stay visible after you click away.
  2. Find All. Press Ctrl+F (Cmd+F), type #DIV/0!, open Options, set Look in to Values, tick Match entire cell contents, set Within to Workbook and click Find All. The list at the bottom shows sheet, cell and formula for every hit; Ctrl+A inside the list selects them all.
  3. Error Checking. Formulas › Formula Auditing › Error Checking jumps from one error to the next and offers Show Calculation Steps, which opens Evaluate Formula on that cell so you can see the exact step that fails.
  4. Trace Error. Select an error cell and choose Formulas › Error Checking (the arrow beside it) › Trace Error. Red arrows lead back to the cell where the error started; blue arrows show the healthy inputs. Errors travel downstream, so fixing the first cell often clears dozens of others.
  5. Count them with a formula. =COUNTIF(B2:B500, "#DIV/0!") counts the cells in a range that show this error, and =SUMPRODUCT(--ISERROR(B2:B500)) counts every kind of error. Put the count next to a report total as an early-warning light.
  6. Total a column that contains #DIV/0! without fixing every cell: =AGGREGATE(9, 6, D2:D50) sums while ignoring errors, and =AGGREGATE(1, 6, D2:D50) averages.

IF, IFERROR or DIVIDE-style guards?

FormulaResult when the divisor is 0Notes
=IF(C2=0, "", B2/C2)EmptyBest: handles exactly the zero case
=IF(C2, B2/C2, "")EmptyShorter: 0 counts as FALSE in a logical test (and so does an empty cell)
=IFERROR(B2/C2, "")EmptyAlso hides #VALUE! from text and #REF! from deleted cells
=IFERROR(B2/C2, 0)0Avoid: a fake zero gets included in totals and averages

When you should NOT hide #DIV/0!

  • When 0 would be a lie. An average order value, conversion rate or margin of 0 is a real number that people will read and compare. If the true answer is "no data", show that, not 0.
  • When the divisor should never be zero. If headcount, units produced or hours worked is 0 because the input is missing, the #DIV/0! is telling you the data feed failed. Fix the input; do not hide the symptom.
  • In averages of ratios. If you replace #DIV/0! with 0 and then average the column, the zeros drag the average down. Return "" (which AVERAGE ignores) or use AGGREGATE.
  • During development. Let the errors show until the model is complete, then add guards deliberately.

Version notes

  • #DIV/0! exists in every version of Excel and in all major spreadsheet programs.
  • IFERROR needs Excel 2007 or later; in Excel 2003 use =IF(ISERROR(B2/C2), "", B2/C2).
  • AGGREGATE needs Excel 2010 or later.
  • In Microsoft 365, functions that build arrays (FILTER, UNIQUE) can make the average fail earlier with #CALC! before any division happens.

Check yourself

1. Which formula shows an empty cell only when the divisor C2 is zero, and still reports other errors?

2. =AVERAGEIF(A2:A50, "West", C2:C50) returns #DIV/0!. What does that mean?

3. A product had sales of 0 last year and 8,000 this year. What should the growth column show?

4. Why can =STDEV.S(B2) return #DIV/0!?

More excel errors