LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Counting Text Strings

Thanks a million. That formula worked.
You're awesome :-)



"Peo Sjoblom" wrote:


=SUMPRODUCT(--(B2:B100="Male"),--(C2:C100="White"))

should do it


for better usability replace Male and White in the above formula with for
instance H2 and I2
then put the criteria in those cells, that way you don't need to edit the
formula when you change the criteria


=SUMPRODUCT(--(B2:B100=H2),--(C2:C100=I2))




--
Regards,

Peo Sjoblom






"Kholm" wrote in message
...
I think so. Here is what my worksheet looks like.

Applicant Name Sex Race

John Doe Male White
Jane Doe Female Hispanic
James Doe Male African American

I need to be able to calculate how many people are both male and white.
In
this example the answer is 1, but I don't know how to write the formula to
do
this.

When I use 2 formulas and add them like you suggested it gives me an
answer
of 3 as it is counting the number of times Male appears and the number of
times White appears.


I appreciate all your suggestions thus far and will greatly appreciate any
more you may have. I'm on a deadline to get this done for my boss and I'm
stuck.

Thanks.
"Peo Sjoblom" wrote:

So are these part of other strings?

Also note that SUBSTITUTE is case sensitive so it won't count male (you
can
wrap the cell references in LOWER and use "male" and all version will be
counted

Otherwise why don't you just use 2 formulas and add them

=SUM(LEN(B2:B100)-LEN(SUBSTITUTE(B2:B100,"Male","")))/LEN("Male")+
SUM(LEN(B2:B100)-LEN(SUBSTITUTE(B2:B100,"Female","")))/LEN("Female")

also if you replace SUM with SUMPRODUCT you don't need to array enter the
formula


Of course if there are no other strings and your data looks like


Male
Male
Female
etc

you can simply use



=SUM(COUNTIF(A2:A100,{"Male","Female"}))

will do the job if there are no other strings in the cells



--
Regards,

Peo Sjoblom






"Kholm" wrote in message
...
I'm not very knowledgable with Excel so I'm not sure how my data is
formatted.

The info I am trying to count is in 2 separate columns. One column is
labeled sex and the other is race.

Here is the array formula I am using to count single strings of text.

=SUM(LEN(B2:B100)-LEN(SUBSTITUTE(B2:B100,"Male","")))/LEN("Male")

"bj" wrote:

I think we need more info
how is your data formatted?
is the info you are looking for the only thing in a given cell or is
it
only
part of the cell?
What array formula are you currently using?

"Kholm" wrote:

How do I count the number of occurrences of two text strings in a
range? I
am compiling demographic information for my boss at work and need to
know the
number of caucasion males, caucasion females, etc. I have already
created
the array formulas to count one text string in a range (i.e. number
of
males
and females), but I do not know how to count two. Please help!






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting frequency of strings in cells tom ossieur Excel Worksheet Functions 4 February 28th 07 03:00 PM
Counting strings in excel with Pivot navin Excel Discussion (Misc queries) 4 January 3rd 07 02:17 PM
Counting Text Strings With Conditions [email protected] Excel Discussion (Misc queries) 2 July 15th 06 08:05 PM
Counting text strings 525047 Excel Worksheet Functions 1 April 21st 06 05:35 AM
counting unique strings Sparky Mark Excel Discussion (Misc queries) 3 January 20th 05 11:47 PM


All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"