XL: COUNTIF/SUMIF Wrong If Cell Has Single Apostrophes

Last reviewed: February 2, 1998
Article ID: Q150369
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for Windows 95, version 7.0, 7.0a
  • Microsoft Excel for the Macintosh, version 5.0, 5.0a

SYMPTOMS

In Microsoft Excel, when you use the COUNTIF and SUMIF functions, you may receive incorrect results if cells included in the range argument contain an apostrophe.

CAUSE

This problem occurs because COUNTIF and SUMIF functions may consider apostrophes in cells of the range argument as matching the criteria argument when that argument is a value.

If the criteria argument is entered as a value without quotation marks, then cells containing only an apostrophe that are directly below a cell that matches the value are considered matching the criteria as well. In addition, cells containing an apostrophe that are below a cell that matches the criteria, but have intervening cells (that is, either blank cells or cells containing text) are considered matching. Other cells with a single apostrophe are not counted or summed. Any cell with a value in it that is interposed between a matching cell and the cell containing the apostrophe prevents that cell from being counted.

If the criteria is entered with quotation marks around the value, all cells with single apostrophes are counted as fitting the criteria.

The problem does not exist if any characters are to the right of an apostrophe.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. The problem is corrected in both Microsoft Excel 97 for Windows and Microsoft Excel 98 Macintosh Edition.

WORKAROUND

To avoid this problem, do not use apostrophes in ranges to be used with the SUMIF or COUNTIF function.


Additional query words: 5.00 5.00a 5.00c 5.0 5.0c 7.00 7.00a
Keywords : xlformula
Version : WINDOWS:5.x,7.0,7.0a; MACINTOSH:5.0,5.0a
Platform : MACINTOSH WINDOWS
Issue type : kbbug
Solution Type : kbworkaround


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.