XL97: Countif Function May Not Work with Blank Cells

Last reviewed: January 15, 1998
Article ID: Q161757
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

The worksheet function Countif may return an incorrect result when the criteria is set to blank ("").

CAUSE

The Countif function takes two arguments: the range and the criteria. If the criteria is specified to be blank (""), the Countif function may return an incorrect result. Other criteria will return the correct result.

For example, if cell A1 has the formula

   =Countif(B1:B2,"")

the result in cell A1 may be 0 even if both B1 and B2 are blank.

If data was previously placed into cells B1 and B2 and then deleted or erased, the Countif function returns the correct value.

WORKAROUND

To calculate the number of blank cells in a range, use the Countblank function instead of the Countif function. The Countblank function will return the correct value of blank cells in a given range.

For example, the following formula will return the count of blank cells in the range A1:A10:

   =COUNTBLANK(A1:A10)

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

REFERENCES

For more information about the Countif function, click the Index tab in Microsoft Excel Help, type the following text

  countif

and then double-click the selected text to go to the "Countif worksheet function" topic.


Additional query words: XL97 97 countif blank empty count if
Keywords : xlformula kbualink97
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb


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: January 15, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.