Phantom Counts

Written by Allen Wyatt (last updated July 18, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


5

There are two closely related worksheet functions in Excel: COUNT and COUNTA. The COUNT function counts all cells that contain numbers, while the COUNTA function counts all cells that are not empty. Thus, if you use COUNTA, you would get "phantom counts" if a cell contained a space; this problem would not occur if you used the COUNT function.

What can cause "phantom counts" when using COUNT is if some cells contain the value zero. This is considered a number by Excel, so it includes that cell in the count. The confusion often pops up if you have the worksheet configured to not display zero values. Thus, the cell could appear to be empty, but really contain a zero which affects COUNT.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9201) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Embedding Your Phone Number in a Workbook

Want to provide a bit of contact information in a workbook? A great place to do it (out of sight, but not inaccessible) ...

Discover More

Printing All or Nothing

Want to make sure that when you worksheet is printed that everything in the workbook is really printed? You can ...

Discover More

Embedding Your Phone Number in a Workbook

Want to provide a bit of contact information in a workbook? A great place to do it (out of sight, but not inaccessible) ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Converting to Other Number Systems

Most calculations are done using the decimal numbering system. If you need to convert your decimal values to a differing ...

Discover More

Determining a Value of a Cell

Cells can store all sorts of information that can be formatted and displayed in a myriad of ways. If you want to quickly ...

Discover More

Finding Unique Rows Based on Two Columns

Using the UNIQUE function you can derive unique values from a range of cells. By expanding the range of cells accessed by ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five less than 5?

2019-06-26 13:32:52

KAT

Thanks so much, Steve! I was just trying to figure out when to use the &. :)


2019-06-25 15:09:25

SteveJez

Kat,
The ampersand joins "<>"and 0 or "" together to form <>0 or <>"" when the formula calculates. The formula can't accept <>0 hence the need to join the comparator <> (not equal to) to the zero to form "NOT equal to 0". The "" represents a null string - nothing, empty, nada - therefore, "<>"&"" forms "NOT equal to nothing" ie. the cell must contain something.
In plain language;
The first formula equates to - sum up everything in A1:A9 that is NOT zero. It doesn't matter whether the cells content is greater than zero or less than zero, just sum it up.
The second formula equates to - count all the cells in A1:A9 that are not zero OR null (blank or empty)

I hope that is clearer than mud & helps your understanding.

Steve


2019-06-25 08:21:14

KAT

SteveJez,
Thank you so much!! Would you please explain what the ampersand does?


2019-06-25 03:54:44

SteveJez

KAT,

See the formulas below which relate to the example image ;

=SUMIFS(A1:A9,A1:A9,"<>"&0)
=COUNTIFS(A1:A9,"<>"&0,A1:A9,"<>"&"")

(see Figure 1 below)
HTH

Figure 1. count non zero


2019-06-24 15:40:35

KAT

Anyone know how to count only numbers that are above 0, or possibly below zero?


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.