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.
by Allen Wyatt
(last updated November 18, 2017)
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:
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:
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.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Text placed in cells can either be lowercase, uppercase, or a mixture of the two. If you want to count the cells based ...Discover More
You can easily set up a formula to perform some calculation on a range of cells. When you copy that formula, the copied ...Discover More
Excel is often used to analyze data collected over time. In doing the analysis, you may want to only look at data ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.