Excel displays the #DIV/0! error when a number is divided either by zero (0) or by a cell that contains no value.
Excel displays the #DIV/0! error in one or more cells on a worksheet.
- Entering a formula that performs explicit division by zero (0) — for example, =5/0.
- Using a reference to a blank cell or to a cell that contains zero as the divisor in a formula or function that performs division.
- Running a macro that uses a function or a formula that returns the #DIV/0! error.
When you copy the example data to a blank worksheet, the formulas in cells A3, A4, and A5 all return a #DIV/0! error.
How do I copy an example?
- Select the example in this article. If you are copying the example in Excel Web App, copy and paste one cell at a time.Important Do not select the row or column headers.
Selecting an example from Help
- Press CTRL+C.
- Create a blank workbook or worksheet.
- In the worksheet, select cell A1, and press CTRL+V. If you are working in Excel Web App, repeat copying and pasting for each cell in the example.
Important For the example to work properly, you must paste it into cell A1 of the worksheet.
- To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
After you copy the example to a blank worksheet, you can adapt it to suit your needs.
- Make sure that the divisor in the function or formula is not zero (0) or blank.
- Change the cell reference in the formula to another cell that does not contain a zero or a blank value.
- Enter the value #N/A in the cell that is referenced as the divisor in the formula.
Entering #N/A will change the result of the formula to #N/A from #DIV/0! to indicate that the divisor value is not available.
- Prevent the error value from being displayed by using the IF worksheet function. You can then display 0 or any string as the result.
For example, if the formula that produces the error is =A1/A2, use =IF(A2=0,"",A1/A2) to return an empty string, or =IF(A2=0,0,A1/A2) to return 0.