XL: Formula to Correctly Evaluate Blank Cells

Last reviewed: February 2, 1998
Article ID: Q149577
The information in this article applies to:
  • Microsoft Excel for Windows, versions 4.x, 5.0, 5.0c
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a
  • Microsoft Excel 97 for Windows
  • Microsoft Excel for the Macintosh, versions 4.0, 5.0, 5.0a
  • Microsoft Excel 98 Macintosh Edition

SUMMARY

In Microsoft Excel, when you use a formula that tests for a zero value, you may see unexpected results if the cell is blank. Microsoft Excel interprets a blank cell as zero, and not as empty or blank. Therefore, any cells that are blank are evaluated as zero in the function.

MORE INFORMATION

If you are checking a cell for a zero value and the cell is blank, the test evaluates to true. For example, if you have the following formula in cell A1:

   =IF(B1=0,"zero","blank")

and B1 is blank, the formula returns "zero" and not "blank" as expected.

If the range might contain a blank cell, you should use the ISBLANK function to test for a zero value, as in the following example:

   =IF(ISBLANK(B2),"blank",IF(B2=0,"zero","other"))

Note that the above formula returns "zero" if there is a zero value in the cell, "blank" if the cell is blank, and "other" if anything else in the cell.

You must always use the ISBLANK formula first before you test for a zero value, otherwise you will always return a "true" for the zero value, and never get to the test for the ISBLANK formula.


Additional query words: 98 XL98 XL97 XL7 XL5 XL4
Keywords : xlformula
Version : MACINTOSH:4.x,5.0,5.0a,98; WINDOWS:5.0,5.0c,7.0,7.0a,97
Platform : MACINTOSH WINDOWS
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.