Note: The other languages of the website are Google-translated. Back to English
English English

Excel: How to fix divide by zero errors

In Excel, when you use the dividing formula, a #DIV/0! error will appear if the divisor is blank or zero which may influence the accuracy of subsequent calculations as the below screenshot shows. Here introduce some methods on avoiding the #DIV/0! Errors in Excel.
doc fix divide zero error 1

Only fix divide by zero errors

Fix all errors

Using IFERRO function

Using a handy tool


Only fix divide by zero errors

Only fix #DIV/0! Errors, you can use the IF function.

1. Select the cell where you want to place the quotient, then click Formula > Insert Function.
doc fix divide zero error 1

2. In the Insert Function dialog, choose IF from the Select a function section. Click OK.
doc fix divide zero error 1

3. In the Function Arguments dialog, please do as below:

In Logical_text textbox, type B2=0 (here B2 is the cell reference of the first divisor, change it to your real need);

In Value_if_true textbox, leave it blank;

In Value_if_false textbox, type A2/B2 (where A2 is the cell reference of the first dividend, and B2 is the cell reference of the first divisor, change them to your real need).

Click OK.
doc fix divide zero error 1

4. The first quotient has been got. Then drag the auto-fill handle down to get all results. You can see there will be some zeros if the related divisors are blank or zeros. And the subsequent calculation is calculated correctly, too.
doc fix divide zero error 1

Note: you can directly use the IF function in the cell without applying it by enabling the Insert Function feature.


Fix all errors

If you want to fix all errors in a range of cells, you can use choose one of the below methods.

Using IFERROR function or combine IF and ISERROR functions

If you are in Excel 2007 and later versions, the IFERROR function can help you.

Select a cell that place the first quotient, then use the IFERROR function as this;

=IFERROR(A2/B2,0)

//here A2 is the cell reference of the first dividend, and B2 is the cell reference of the first divisor, change them to your real need, 0 is the returned value if A2/B2 returns any error.

Press Enter key to get the first result, then drag auto handle down to fill other cells with this formula.
doc fix divide zero error 1

If you are in Excel versions prior to Excel 2007, you can combine IF and ISERROR functions to achieve it.

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

//here A2 is the cell reference of the first dividend, and B2 is the cell reference of the first divisor, change them to your real need, 0 is the returned value if A2/B2 returns any error.
doc fix divide zero error 1

Using a handy tool

If you have Kutools for Excel installed in Excel, the Error Condition Wizard feature can quickly convert all types of errors to blanks, a specified value, or a value of a selected cell.

1. Select the range you want to convert errors, then click Kutools > More > Error Condition Wizard.
doc fix divide zero error 1

2. In the Error Condition Wizard dialog, choose Any error value from the Error types drop-down list, then choose one option as you need in the Error display section. Click Ok.
doc fix divide zero error 1

Now the errors have been converted to the values that you specified.
doc fix divide zero error 1

With Error Condition Wizard, you can choose the type of error you want to do in the Error types list.
doc fix divide zero error 1

For more details about Error Condition Wizard, please visit here.

For all features about Kutools for Excel, please visit here.

For free 30-day trial, please download now.

.

Other Operations (Articles)

How To Fix/Lock Background Color In A Sheet
Sometimes, when you share a sheet with others to edit, you may want to lock the background color in a range of cells and prevent them to be changed.

How To Fix Broken Links
In a workbook, sometimes, you may create links to other workbooks for referring to some relevant information. But when the source workbook is renamed or moved to another location, these extra links will be broken.

Excel: How To Create Or Insert A Bookmark
Have you ever imagined creating or inserting a bookmark for quickly jumping to a specific data range while there is a lot of data in a worksheet or a workbook?

How to apply shading to odd or even (alternative) rows/columns in Excel?
While designing a worksheet, many people tend to apply shading to odd or even (alternative) rows or columns in order to make the worksheet more visual. This article will show you two methods to apply shading to odd or even rows/columns in Excel.



  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns and Keeping Data; Split Cells Content; Combine Duplicate Rows and Sum/Average... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Favorite and Quickly Insert Formulas, Ranges, Charts and Pictures; Encrypt Cells with password; Create Mailing List and send emails...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • Pivot Table Grouping by week number, day of week and more... Show Unlocked, Locked Cells by different colors; Highlight Cells That Have Formula/Name...
kte tab 201905
  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations