Excel Formula to Return Zero for Zero Values and Leave Empty Cells Blank
Question details
The user needs a division formula that returns zero when both inputs are numeric zeros and stays blank when both inputs are empty.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet divides a numerator by a denominator, but the inputs may both be zero or both be empty.
- Observed behavior
- A standard division formula returns #DIV/0! for a zero denominator, while empty inputs should produce a blank result.
Identify the numerator and denominator cells and choose a separate cell for the result. The examples use A1 as the numerator, B1 as the denominator, and C1 as the result.
Use ISNUMBER to distinguish numeric zeros from empty cells
Use this formula when two numeric zeros should return 0 and two empty inputs should return a blank.
ISNUMBER checks that both inputs are numeric before the formula treats two zeros as a special case. LEN(A1&B1)=0 checks whether both inputs are empty or return empty text.
Open the worksheet in Excel and select C1, or another cell separate from the inputs.
Type =IF(AND(ISNUMBER(B1),ISNUMBER(A1),B1=0,A1=0),0,IF(LEN(A1&B1)=0,"",A1/B1)) in the formula bar and press Enter.
Enter 0 in both A1 and B1 to check that C1 returns 0. Clear both input cells to check that C1 appears blank, then enter a nonzero denominator to test division.

Leave the result blank when either input is empty
Use this variation when either missing input should leave the result blank and a nonzero numerator with a zero denominator should also display blank.
Handle Zero and Blank Inputs in WPS Spreadsheet
Use the same ISNUMBER and IF formula in WPS Spreadsheet to distinguish two numeric zeros from two empty inputs in a division calculation.
- 1. Open the spreadsheet: Open WPS Spreadsheet and use Open to select your workbook.
- 2. Choose the result cell: Select C1, with the numerator in A1 and the denominator in B1.
- 3. Enter the formula: In the formula bar, enter =IF(AND(ISNUMBER(B1),ISNUMBER(A1),B1=0,A1=0),0,IF(LEN(A1&B1)=0,"",A1/B1)) and press Enter.
- 4. Verify the result: Enter zeros in both input cells, then clear both cells, and check that C1 returns 0 and then appears blank.

Frequently Asked Questions
Why does the formula use ISNUMBER?
ISNUMBER confirms that each input is numeric, so the special zero result applies to two numeric zeros rather than two blank cells.
Will the recommended formula prevent every #DIV/0! error?
No. It returns 0 for two numeric zeros and blank for two empty inputs, but a nonzero numerator divided by a zero or empty denominator still produces #DIV/0!.
What happens if only the numerator is blank?
With the recommended formula, Excel performs the division if the denominator is not blank. If either missing input should leave the result blank, use the alternative formula.
Does the blank result make the formula cell empty?
No. The formula returns an empty text string, so the cell looks blank but still contains a formula. Select the cell and check the formula bar to see it.




