Formula Errors

Fix an Excel IF Formula That Misclassifies Zero Values

John WilsonJohn Wilson Nov 20, 2026 868 views

Question details

The user needs an Excel IF formula to classify values consistently when a cell displays zero.

Fix an Excel IF Formula That Misclassifies Zero Values
Product
Microsoft Excel
Device & OS
not provided
Scenario
An IF formula checks a calculated cell whose displayed value may be rounded to zero.
Observed behavior
The formula can return an unexpected Good or Bad result because the underlying value differs from the displayed value or INT handles negative values differently than expected.
Before you start

Select the cell being tested and use Home > Increase Decimal to reveal more decimal places. Decide whether values that round to zero should count as zero and how many decimal places matter.

Solution 1Recommended

Round the value before testing it in Excel

Use ROUND when values that round to zero at a chosen precision should be treated as zero.

1
Inspect the value

Select D21 and choose Home > Increase Decimal to check whether the displayed zero hides a small positive or negative value.

2
Enter the IF formula

Select the result cell and enter =IF(ROUND(D21,4)=0,"GOOD","BAD"). Replace D21 with the cell you want to test.

3
Set the precision

Change 4 in the formula to the number of decimal places required. For example, use 2 to treat values that round to zero at two decimal places as zero.

Round the value before testing it in Excel
Choose the correct labels: This formula returns GOOD when the rounded value is zero. Swap GOOD and BAD if zero should instead be classified as BAD.
Work with formulas in WPS Spreadsheet

Check zero values with IF and ROUND in WPS Spreadsheet

Open your workbook in WPS Spreadsheet and use IF with ROUND to classify values at the precision you choose.

  1. 1. Open the workbook: Open WPS Spreadsheet and use Open to select your Excel workbook.
  2. 2. Check the displayed precision: Select the value cell and use the decimal-place controls on the Home tab to show more digits.
  3. 3. Enter the formula: Select the result cell and enter =IF(ROUND(D21,4)=0,"GOOD","BAD"), adjusting the cell reference and precision as needed.
  4. 4. Save the workbook: Use File > Save As and choose XLSX if you want to keep the workbook in Excel format.
Test rounded zero values with familiar IF and ROUND formulasOpen and save Microsoft Excel XLSX workbooksInspect decimal places using familiar spreadsheet controlsUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel show zero when my IF formula treats the value as nonzero?

Cell formatting may display a small positive or negative value as zero. Select the cell and use Home > Increase Decimal to reveal more digits, or use ROUND in the IF test.

How do I return BAD when the rounded value is zero?

Swap the result labels in the formula: =IF(ROUND(D21,4)=0,"BAD","GOOD"). Change 4 to your required decimal precision.

Why can INT give an unexpected result for a negative value?

INT rounds down to the nearest integer, so INT(-0.1) returns -1. TRUNC removes decimal digits toward zero, so TRUNC(-0.1) returns 0.

Can I leave the result blank when another cell is empty?

Yes. For example, use =IF(C20="","",IF(ROUND(D21,4)=0,"GOOD","BAD")) to leave the result blank when C20 is empty.

How can I test for an exact zero without rounding?

Use =IF(D21=0,"GOOD","BAD"). This tests the stored value, so a tiny nonzero result from a calculation will return BAD even if the cell displays zero.