# Correct a #DIV/0! error

Microsoft Excel displays the #DIV/0! error when a number is divided either by zero (0) or by a cell that contains no value.

## Symptom

Excel displays the #DIV/0! error in one or more cells on a worksheet.

## Causes

• 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.

## Example

When you copy the example data to a blank worksheet, the formulas in cells A3, A4, and A5 all return a #DIV/0! error.

1. 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

1. Press CTRL+C.
2. Create a blank workbook or worksheet.
3. 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.

1. 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.

A
1
0
=A1/0
=A1/A2
=QUOTIENT(A1,A2)

## Resolution

• 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.

Applies to:
Excel 2010