Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Counting Non-Blank Cells.

Counting Non-Blank Cells

Written by Allen Wyatt (last updated May 19, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


1

You may already know that you can use the COUNTBLANK function to return the number of blank cells in a range. What if you want to count the number of non-blank cells in the same range? One way is to use the COUNTA function, as shown here:

=COUNTA(B1:B13)

The only problem with this formula is that it doesn't return the complementary value to what COUNTBLANK returns. In other words, the result of COUNTA added to the result of COUNTBLANK doesn't equal the total number of cells in the original range. The reason for this is that both COUNTBLANK and COUNTA treat formulas different. COUNTBLANK includes, as blank, formulas that return a blank value. COUNTA does not consider such cells blank (even though a blank is returned), so it includes them in its count.

If you consider non-blank cells to be those that are not returned by COUNTBLANK, then you will need to use a longer formula:

=(ROWS(B1:B13)*COLUMNS(B1:B13))-COUNTBLANK(B1:B13)

This formula subtracts the COUNTBLANK result from the total number of cells in the same range.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2996) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Counting Non-Blank Cells.

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

Filling A Drawing Object

Creating a drawing object can be just the first step in putting together your masterpiece drawing. This tip explains how ...

Discover More

Averaging Values for a Given Month and Year

Excel is often used to analyze data collected over time. In doing the analysis, you may want to only look at data ...

Discover More

Adding a Line Shape of a Given Slope and Length

If you want to create a line in your worksheet that is a specific length and slope, there are a couple of ways you can do ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Calculating the Distance between Points

Want to figure out how far it is between two points on the globe? If you know the points by latitude and longitude, you ...

Discover More

Returning Least-Significant Digits

Do you ever have a need to return just a few digits out of a number? This tip shows different formulas you can use to ...

Discover More

Adding Dashes between Letters

When processing some text data, you may need to perform some esoteric function, such as adding dashes between letters. ...

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 six minus 4?

2018-12-26 15:10:35

MARLENE CASE

I don't understand. I used your formula, but I get the same answer for both formulas; 69

=COUNTA(J2:J98)

=(ROWS(J2:J98)*COLUMNS(J2:J98))-COUNTBLANK(J2:J98)

I am trying to figure out why Excel is not counting the cells that have an X in them correctly. When I counted by hand there are 67 cells with x in them and yet Excel insists upon telling me it is 69.

I thought by countblank I could figure it out until I read your hint. Now I am even more confused. I have never had this problem with Excel before I started using Microsoft 365. Very frustrating.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.