Fix an Excel IF Formula That Misclassifies Zero Values
Question details
The user needs an Excel IF formula to classify values consistently when a cell displays zero.

- 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.
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.
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.
Select D21 and choose Home > Increase Decimal to check whether the displayed zero hides a small positive or negative value.
Select the result cell and enter =IF(ROUND(D21,4)=0,"GOOD","BAD"). Replace D21 with the cell you want to test.
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.

Use TRUNC instead of INT when cutting decimals toward zero
Use TRUNC when you want to discard decimal places rather than round them before the IF test.
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. Open the workbook: Open WPS Spreadsheet and use Open to select your Excel workbook.
- 2. Check the displayed precision: Select the value cell and use the decimal-place controls on the Home tab to show more digits.
- 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. Save the workbook: Use File > Save As and choose XLSX if you want to keep the workbook in Excel format.

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.




