MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Counting cells containing text


Posted by Robin on January 08, 2001 4:21 AM

I have been asked if there is any way to count the number of cells that fall under a certain category.

Eg.

Male names
Mark
John
Paul
George

Female names
Wendy
Joanne
Rachel

This data appears in the same column in a worksheet. How can I get Excel to count the number of entries under the "male" and "female" categories?
Also, the number of names under each section changes every month and the number of blank cells may well alter as well. Thanks, Robin


Posted by Aladin Akyurek on January 08, 2001 5:11 AM

Counting males or females is no problem if the sex (M/F) associated with each name is known. If all these names are in column A, you'll need to enter the sex for each name/person in B. Let's say the sex values are available in B, then put in
C1 =countif(A:A,"M")
C2 =countif(A:A,"F")

That's all.

Aladin

Posted by Aladin Akyurek on January 08, 2001 5:21 AM

: Mark : John : Paul : George : Wendy : Joanne : Rachel : Also, the number of names under each section changes every month and the number of blank cells may well alter as well. Thanks, Robin C1 =countif(A:A,"M") C2 =countif(A:A,"F")

The formulas should be:

:C1 =countif(B:B,"M")
:C2 =countif(B:B,"F")