Formula Errors

Excel Formula to Return Zero for Zero Values and Leave Empty Cells Blank

Bushra ParveenBushra Parveen Nov 27, 2026 870 views

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.

Return Zero for Zero Values and Blank for Empty Cells in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the result cell

Open the worksheet in Excel and select C1, or another cell separate from the inputs.

2
Enter the formula

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.

3
Test the inputs

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.

Use ISNUMBER to distinguish numeric zeros from empty cells
Other zero-denominator cases: This formula does not suppress every #DIV/0! error. For example, a nonzero A1 divided by a zero or empty B1 still produces an error.
WPS Spreadsheet formula

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. 1. Open the spreadsheet: Open WPS Spreadsheet and use Open to select your workbook.
  2. 2. Choose the result cell: Select C1, with the numerator in A1 and the denominator in B1.
  3. 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. 4. Verify the result: Enter zeros in both input cells, then clear both cells, and check that C1 returns 0 and then appears blank.
Return zero for two numeric zeros while leaving two empty inputs blankOpen and edit Microsoft Excel XLSX filesUse familiar spreadsheet cells and formula functions
microsoft office alternative - wps office

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.