Count non-blank cells?

M

Matt

I would like to count the number of cells in a range that are blank
(or that appear blank). That is, it would count empty cells as well
as cells whose formula returns a blank (=""). Is this possible?
 
T

T. Valko

Try this:

=COUNTBLANK(A1:A10)

Counts both empty cells and cells that contain formula blanks.
 
M

Matt

Now how about this:

How would I count the number of cells that are NOT blank? So that
even if the cell does contain a formula but still shows as blank (such
as ="") , then it is not counted as a non-blank cell
 
T

T. Valko

If the cells contain only TEXT entries:

=COUNTIF(A1:A10,"?*")

Or, this generic version will count any type of entry:

=SUMPRODUCT(--(LEN(A1:A10)>0))
 
M

Matt

=COUNTIF(A1:A10,"?*")
=SUMPRODUCT(--(LEN(A1:A10)>0))

Both work perfectly. What does the "?*" mean? and what does the --
before the len function do?

Thank you!
 
T

T. Valko

What does the "?*" mean?

Both the ? and the * are wildcard characters.

The ? wildcard represents any *single* text character.

The * represents any number of text characters.

These wildcards only work on TEXT.

So the formula checks to make sure there is any single text character or any
number of text characters in the cells. A formula blank ("") is not any
single text character and fails the test so it's not counted.
what does the -- before the len function do?

See these:

http://xldynamic.com/source/xld.SUMPRODUCT.html

http://mcgimpsey.com/excel/formulae/doubleneg.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top