How To Fix The #DIV/0! Error In Excel (2026)
Excel shows #DIV/0! when a formula divides a number by zero.
The same thing happens when the divisor is a blank cell, which is why a formula that worked yesterday can break when someone clears a cell.
This guide uses Microsoft’s own fixes, from correcting the divisor to hiding the error while you wait for input.
Table of Contents
- Quick answer: fix the divisor or test it first
- What causes #DIV/0!
- Fix the divisor directly
- Show #N/A when the divisor is missing
- Use IF to test the divisor first
- Use IFERROR to catch the error
- The caution about hiding errors
- Hide a zero or the error markers
- Step through the error
- Replace errors in a PivotTable
- Which method to choose
- The short guard formula from Microsoft
- How #DIV/0! differs from other errors
- Turn error checking on or off
- Related Excel errors
- Official sources
- More Word, Excel and PowerPoint guides
Quick answer: fix the divisor or test it first
Check the number you are dividing by, because it is zero or empty.
| Situation | Fix |
|---|---|
| The divisor should have a value | Enter the value, or point the formula at a different cell |
| The divisor is not known yet | Wrap the formula in IF or IFERROR |
| You want to flag missing data | Enter #N/A in the divisor cell |
What causes #DIV/0!
Microsoft names two causes.
- You enter a formula such as
=5/0. - A formula refers to a cell that contains 0 or is blank.
In a formula like =A2/A3, the cell after the slash is the divisor, so look at A3 first.
Fix the divisor directly
When the error is a real mistake, change the data or the reference.
- Click the cell showing #DIV/0! and read the formula in the formula bar.
- Find the divisor, which is the cell after the division sign.
- Make sure that cell is not zero or blank.
- If it should hold a number, type it in.
- If the reference is wrong, point the formula to a different cell that does not contain 0 or a blank.
Show #N/A when the divisor is missing
Another option on Microsoft’s page is to enter #N/A in the divisor cell.
The formula result then changes to #N/A, which tells readers that the divisor value is not available instead of implying a calculation failed.
Use IF to test the divisor first
If the divisor will be filled in later, test it before dividing.
The formula =A2/A3 becomes =IF(A3,A2/A3,0), which divides only if A3 has a value and otherwise returns the alternative you choose.
| Formula | Result when A3 is 0 or blank |
|---|---|
=IF(A3,A2/A3,0) | 0 |
=IF(A3,A2/A3,"") | An empty string |
=IF(A3,A2/A3,"Input Needed") | The message Input Needed |
=IF(A3,QUOTIENT(A2,A3),0) | 0, using QUOTIENT instead of the division sign |
The logic is that if A3 has a value the formula returns the division result, and otherwise it returns the alternative.
Use IFERROR to catch the error
IFERROR returns a value you specify if the formula evaluates to an error, and the normal result otherwise.
The syntax is IFERROR(value, value_if_error), so =IFERROR(A2/A3,0) returns 0 when the division fails.
Microsoft’s own example divides 55 by 0 and returns the text Error in calculation, while 210 divided by 35 returns 6.
| Formula | Result |
|---|---|
=IFERROR(210/35,"Error in calculation") | 6 |
=IFERROR(55/0,"Error in calculation") | Error in calculation |
=IFERROR(A2/A3,0) with A3 blank | 0 |
If either argument is an empty cell, IFERROR treats it as an empty string.
The caution about hiding errors
Both IFERROR and IF with ISERROR suppress every error, not only #DIV/0!.
A typo that causes #NAME? or a deleted cell that causes #REF! would be hidden too.
Microsoft’s advice is to confirm that the formula works correctly before you add error handling, or you may miss a real problem.
The IF(A3,…) form is safer for division because it reacts only to a zero or blank divisor.
Hide a zero or the error markers
If the 0 returned by IFERROR looks odd, Microsoft shows a way to hide it without removing the value.
- Select the cells and go to Home > Conditional Formatting > New Rule.
- Create a rule for a cell value equal to 0.
- Set a custom number format of three semicolons,
;;;.
The cell then shows nothing, but the value 0 remains.
To remove the green triangles instead, go to File > Options > Formulas and clear Enable background error checking.
Step through the error
If error checking is turned on, a button appears next to the cell showing the error.
- Select the button next to the cell.
- Select Show Calculation Steps, if it is available.
- Choose the resolution that fits your data.
On Windows you can also use Formulas > Formula Auditing > Evaluate Formula to see each part of a nested formula calculate.
Replace errors in a PivotTable
A PivotTable has its own setting for error values.
- Select the PivotTable.
- On the PivotTable Analyze tab, click the arrow next to Options, then click Options.
- On the Layout & Format tab, select For error values show and type the text to display.
Leave the box empty to show blank cells.
Which method to choose
Pick the method by what you want the sheet to show while the divisor is missing.
| Method | Best when | Watch out for |
|---|---|---|
| Fix the divisor | The zero or blank is a mistake | Nothing to hide, the formula just works |
| IF on the divisor | You want a blank, 0 or message until input arrives | Only reacts to a zero or blank divisor |
| IFERROR | You want any error replaced | Also hides unrelated errors |
| #N/A in the divisor | You want to flag the value as unavailable | Result shows #N/A instead of #DIV/0! |
The short guard formula from Microsoft
Microsoft’s broken-formulas page gives the same guard in its shortest form, =IF(B1,A1/B1,0).
If B1 has a value, the formula divides A1 by B1, and otherwise it returns 0.
Copy that pattern down a column and every row protects itself.
How #DIV/0! differs from other errors
| Error | What it means |
|---|---|
| #DIV/0! | A number is divided by zero or by an empty cell |
| #NAME? | Excel does not recognize text in the formula |
| #N/A | A value is not available to a function |
| #REF! | A cell reference is no longer valid |
| #VALUE! | The formula mixes incompatible data types |
Turn error checking on or off
The green triangle and the button beside the cell only appear when background error checking is on.
On Windows go to File > Options > Formulas, and on Mac go to the Excel menu > Preferences > Error Checking.
To walk through every flagged cell one by one, use Formulas > Formula Auditing > Error Checking.
Related Excel errors
For the other common error values, see how to fix #N/A, #VALUE! and #REF! errors in Excel.
If a misspelled function is behind your error, read how to fix the #NAME? error in Excel.
If the formula shows as text instead, try Excel formulas not calculating.
Official sources
The fixes come from Microsoft’s How to correct a #DIV/0! error, with details from IFERROR function and Hide error values and error indicators in cells.
More Word, Excel and PowerPoint guides
- Excel Error: There Isn't Enough Memory To Complete This Action
- How To Combine Data From Multiple Sheets In Excel (2026)
- How To Keep Leading Zeros In Excel (2026)
- How To Round Numbers In Excel With ROUND (2026)
- How To Use AutoSum And The SUM Function In Excel (2026)
- How To Find And Replace In Excel (2026)