If you’re an Excel user, you’ve probably encountered the dreaded #DIV/0 error at some point. This error occurs when you attempt to divide by zero.

In the example below cell A6 is blank, therefore Excel evaluates A6 as zero and the formula returns the #DIV/0! Error.

Excel spreadsheet with a formula in cell C6 =B6/A6 and an empty cell in cell A6

Excel #DIV/0 errors can be frustrating to deal with. Not only are they a bit distracting, but they can also impact other calculations if the cell they are in is referenced in another formula.

Fortunately, you can take a few simple steps to remove or hide this error.

1. Use the IFERROR function to remove an Excel #DIV/0 error

One of the easiest ways to remove the #DIV/0 error is to use the IFERROR function. This function allows you to specify what you want to happen if an error occurs in a formula.

In the example below, cell E14 holds the formula =E13/E12, which returns a #DIV/0 Error because cell E12 is blank.

Excel spreadsheet with cell E14 selected and showing #DIV/0 and the formula =E13/E12 in the formula bar

To remove the #DIV/0 error, we can use the formula =IFERROR(E13/E12,””). This formula will return a blank cell if a #DIV/0 error occurs.

Excel spreadsheet with cell E14 selected and empty and the formula =IFERROR(E13/E12,"") in the formula bar

2. Use the IF function to remove an Excel #DIV/0 error

Another way to remove the #DIV/0 error is to use the IF function. This function checks whether the dividend cell is blank and returns a blank cell if it is. For example, the formula =IF(E12=””,””,E13/E12) checks to see if cell E12 is blank. If E12 is blank, the IF function will leave cell E14 blank, but if the cell isn’t blank, Excel will divide cell E13 by cell E12 and return the result into E14.

Excel spreadsheet with cell E14 selected and empty and the formula =IF(E12="","",E13/E12) in the formula bar

Additionally, you can use the IF function with a nested OR function to check if E12 is blank or holds a zero value. If either is True, Excel will leave E14 blank.

Excel spreadsheet with cell E14 selected and empty and the formula =IF(OR(E12="",E12=0),"",E13/E12) in the formula bar

3. Remove Excel #DIV/0 Error in Average formulas

When using AVERAGE functions in Excel, it’s important to be aware of the #DIV/0 error that can occur if one or more of the cells in the range being averaged contains a zero, is blank or the range contains text only.

Cells E19 to E22 are blank with cell E24 selected showing a #DIV/0! error and =AVERAGE(E19:E22) in the formula bar

This is because the general formula for calculating averages is =sumtotal/count, and count can sometimes be zero. In the example below, the COUNT function would return 0, resulting in Excel returning a #DIV0 error.

Cells E19 to E22 are blank with cell E24 selected showing a #DIV/0! error and =SUM(E19:22)/COUNT(E19:E22) in the formula bar

Here are some ways to remove #DIV/0 errors when using average functions in Excel:

4. Use the IFERROR function to remove AVERAGE #DIV/0 errors

Use the IFERROR function to catch any #DIV/0 errors that may occur when using the AVERAGE function.

For example, you can use the formula =IFERROR(AVERAGE(E19:E22),””). This formula will calculate the average of the cells in the range E19:E22, and if a #DIV/0 error occurs, it will return a blank cell instead of the error message.

Excel spreadsheet with cell E26 selected and 154,160.82 in the cell with =IFERROR(AVERAGE(E19:22)."") in the formula bar

5. Use the IFERROR function to remove AVERAGEIF #DIV/0 errors

When using the AVERAGEIF function in Excel, you may encounter the #DIV/0 error if the function is unable to find a match for the criteria within the range being evaluated.

In the example below, the formula calculates the average of cells A28 through to A38, but only for the numbers that meet the condition held in cell D28. The actual numbers that the formula uses to calculate the average are in cells B28 through B38.

The #DIV/0 Error occurred because the value held in cell D28 was entered incorrectly as ‘Haselnuts’ instead of ‘Hazelnuts’. Therefore, Excel is unable to find a match for the criteria, resulting in the #DIV/0 error.

Excel spreadsheet with cell E28 selected showing a #DIV/0! error with the formula =AVERAGEIF(A28:A38,D28,B28:B38) in the formula bar

Once D28 is entered correctly, the #DIV/0 error will disappear.

When the criteria are correct but the #DIV/0 error is showing, wrap an IFERROR function around the AVERAGEIF function to hide the error.

Excel spreadsheet with no #DIV/0! errors and cell E30 selected with +IFERROR(AVERAGEIF(A28:A38,D30,B28:B38),"") in the formula bar

6. Hide a #DIV/0 error using Conditional Formatting

Conditional formatting is a powerful tool in Excel that allows you to format cells based on their values or formulas. One useful application of conditional formatting is to hide the #DIV/0 error that occurs when you attempt to divide a number by zero. Here’s how to do it:

1. Select the range of cells that contains the #DIV/0 error.

2. Click on the Home tab and then select Conditional Formatting.

3. Choose “New Rule” from the dropdown menu.

4. In the New Formatting Rule dialog box.

Excel spreadsheet in the Home tab with Conditional Formatting selected and the mouse hovering over New Rule

5. Select “Format only cells that contain” from the first dropdown menu. In the second dropdown menu, choose “Errors “.

New Formatting Rule dialogue box with 'Format only cells that contain' selected in the 'Select a Rule Type' box and the mouse hovering over Errors in the 'Format only cells with' drop down box

6. Click the Format button.

Errors selected in the 'Format only cells with' box and the mouse hovering over the Format option

7. Apply a format that will hide the error, for example change the font colour to white.

Format cells dialogue box with the drop down box under Color selected and the mouse hovering over the option White, Background 1

8. Click “OK” to apply the formatting rule.

After applying this rule, any cells in the selected range that contain the #DIV/0 error will appear blank. This can make your spreadsheet look cleaner and more professional and help prevent confusion or mistakes that may occur if the error remains visible.

Excel spreadsheet with an empty cell in cell E30

It’s important to note that this method does not remove the error from the cell but hides it from view. Therefore, the error could still impact any formulas referencing it.

I’d recommend only using this method when you want to hide a #DIV/0 error so it doesn’t catch your attention and distract you.

Conclusion

By implementing these methods, you can eliminate the #DIV/0 error in Excel and ensure that your formulas are accurate and reliable, regardless of the function used. These simple steps can help you keep your spreadsheets error-free and ensure that your data analysis is efficient and effective. So, whether using the AVERAGE function or any other formula in Excel that involves division, follow these methods to prevent errors and ensure that your data is always accurate.

Was this post helpful? Let me know in the comments below.


Sharyn Baines
Sharyn Baines
Certified Microsoft Office Specialist

Was this blog helpful? I’m here to empower your journey with Excel, aiming to make your daily tasks more efficient and boost your potential.

Share your thoughts in the Comments below – your insights not only enrich others, they also help me tailor future content to your needs.

And if you’re looking to take a step further, join our exclusive ‘Insider Group‘. As a member, you’ll receive Weekly Super-Tips, and early access to in-depth tutorials. Sign up Today!”

Happy Excel-ling!!

Leave a Reply

Your email address will not be published. Required fields are marked *