Counting Text Cells

  • Thread starter Thread starter Frank West
  • Start date Start date
F

Frank West

Hi, all.

I have a column with many different names. I can count all the cells
with the name, Bob for example: countif(a8:a1000,"Bob"), but what if I
want to get a running total of all the cells with names in them, but
not the blank cells. How do I do that?

Thanks,

Frank West
 
=count(a8:a1000) will give count of all non-blank cells with text
values
=countblank(a8:a1000) will give count of all blank cells
=count(a8:a100) will count all the numbers in the range.
 
Dear Frank,

Use the counta function. I think the other poster just
left off the "a"
example:
=counta(a8:a1000) will return all the non-blank cells in
a range.

Bob Sullivan
Springhouse
 
=count(a8:a1000) will count the number of numeric cells.
=counta(a8:a1000) will count the number of non-empty cells. This includes
formulas that evaluate to "" and look blank.

One way to count the non-blank text cells is:

=SUMPRODUCT(--(ISTEXT(A1:A1000)),--(LEN(A1:A1000)>0))
 
Dear Frank,

Use the counta function. I think the other poster just
left off the "a"
example:
=counta(a8:a1000) will return all the non-blank cells in
a range.

Bob Sullivan

Hi, Bob.

Here's the problem. If I have data in 18 cells and I use
counta(a8:a1000) it returns an answer of 982. I want the answer of
18. I have formulas in those cells and even though some of the cells
are blank I guess it still counts them.

Dave Peterson suggested this solution:

=SUMPRODUCT(--(ISTEXT(A1:A1000)),--(LEN(A1:A1000)>0))

And this works. I guess I was just wondering if the count, counta or
countif method would work as well.

Thanks to all.

FW
 
One way to count the non-blank text cells is:

=SUMPRODUCT(--(ISTEXT(A1:A1000)),--(LEN(A1:A1000)>0))

Hi, Dave. This formula works great, but I was wondering if you could
tell me what the dashes are for in the above formula? I have them in
some other formulas provided to me by posters here, but I can't find
anything in the help files to explain them.

Also, I understand the ISTEXT part of the formula, but why do you need
the LEN in there? Doesn't LEN count the number of characters in a
string? Since I'm only counting cells, how does that figure in?

Thanks,

FW
 
A single minus will convert True to -1. The second one will convert -1 to +1.

-False will be 0 and --false will still be 0.

And =sumproduct() expects numbers as its parameters.

Actually, =istext(a1:a1000) will return a 1000 element array of true/falses (as
will =len(a1:a1000)>0).

The -- part changes each of the elements to 0/1's.

Then the product part of sumproduct will multiply the corresponding elements.
The sum part sums the elements (but both corresponding elements have to be True
(or 1) to get anything besides 0.)
 
A single minus will convert True to -1. The second one will convert -1 to +1.

-False will be 0 and --false will still be 0.

And =sumproduct() expects numbers as its parameters.

Actually, =istext(a1:a1000) will return a 1000 element array of true/falses (as
will =len(a1:a1000)>0).

The -- part changes each of the elements to 0/1's.

Then the product part of sumproduct will multiply the corresponding elements.
The sum part sums the elements (but both corresponding elements have to be True
(or 1) to get anything besides 0.)

Thanks, Dave! That explains a lot.

FW
 
Back
Top