View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Counting non-blank cells

"Sandy Mann" wrote...
Peo Sjoblom" wrote in message

....
=SUMPRODUCT(--(LEN(A1:A10)0))


Why bother using LEN?

=SUMPRODUCT(--(A1:A10<""))

Doesn't that return 0 for cells with "" in them?


Yup. All about specifyine what's intended by 'non-blank', which could be as
above, or

=SUMPRODUCT(--(TRIM(A1:A10)<""))

or

=SUMPRODUCT(--(TRIM(SUBSTITUTE(A1:A10,CHAR(160),""))<""))

I was going to post:

=COUNTBLANK(A1:A10)-COUNTIF(A1:A10,"*")


This can produce negative numbers.

or

=COUNTIF(A1:A10,"=")

or the array entered:

=SUM(--ISBLANK(A1:A10))

....

These count truly blank cells. OP wanted to count nonblank cells. OP should
use Peo's formula, or one of my adaptations of it. There's even

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

but this doesn't include error or boolean values.