Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default How to count the number of text?

There is a list of text from cell A1 to A100, I would like to count the
number of "Mary" within this range, each cell may contain a senstance, such
as Mary goes to school by bus, or John meets Mary in Library ... etc. So far,
the counter for Mary is 2.
Does anyone have any suggestions on how to do it?
Thanks in advance for any suggestions
Eric
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default How to count the number of text?

Try
=COUNTIF(A1:A100,"*Mary*")

OR with the query string in cell B1
=COUNTIF(A1:A100,"*" & B1 & "*")

--
Jacob (MVP - Excel)


"Eric" wrote:

There is a list of text from cell A1 to A100, I would like to count the
number of "Mary" within this range, each cell may contain a senstance, such
as Mary goes to school by bus, or John meets Mary in Library ... etc. So far,
the counter for Mary is 2.
Does anyone have any suggestions on how to do it?
Thanks in advance for any suggestions
Eric

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default How to count the number of text?

Hi Eric

In order to make it generic, I would put the search term - Mary - in a cell.
I used C1 in this formula

=(SUMPRODUCT((LEN(A1:A100)))-
SUMPRODUCT((LEN(SUBSTITUTE(A1:A100,C1,"")))))/LEN(C1)


--
Regards
Roger Govier

Eric wrote:
There is a list of text from cell A1 to A100, I would like to count the
number of "Mary" within this range, each cell may contain a senstance, such
as Mary goes to school by bus, or John meets Mary in Library ... etc. So far,
the counter for Mary is 2.
Does anyone have any suggestions on how to do it?
Thanks in advance for any suggestions
Eric

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default How to count the number of text?

Hi Jacob

Not enough caffeine for me yet this morning.
I was making life very complicated with my solution!!!
Yours is the correct one with the very fast Countif.

Many congratulations on gaining MVP status. Very well deserved.
Was it in January (and I missed it) or has it just happened in April?

--
Regards
Roger Govier

Jacob Skaria wrote:
Try
=COUNTIF(A1:A100,"*Mary*")

OR with the query string in cell B1
=COUNTIF(A1:A100,"*" & B1 & "*")

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default How to count the number of text?

Thanks Roger..This happened in April.

Your approach is the correct one when you have more than one instance of
'Mary' in a cell..and the below would only count exact word match. ie;
Maryland will not be counted...Once again thanks.

=(SUMPRODUCT(((LEN(SUBSTITUTE(A1:A10," ",)))))-
SUMPRODUCT(LEN(SUBSTITUTE(SUBSTITUTE(" " &
SUBSTITUTE(" " & UPPER(A1:A10) & " "," "," "), " " &
UPPER(B1) & " ",)," ",))))/LEN(B1)

--
Jacob (MVP - Excel)


"Roger Govier" wrote:

Hi Jacob

Not enough caffeine for me yet this morning.
I was making life very complicated with my solution!!!
Yours is the correct one with the very fast Countif.

Many congratulations on gaining MVP status. Very well deserved.
Was it in January (and I missed it) or has it just happened in April?

--
Regards
Roger Govier

Jacob Skaria wrote:
Try
=COUNTIF(A1:A100,"*Mary*")

OR with the query string in cell B1
=COUNTIF(A1:A100,"*" & B1 & "*")

.

Reply
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
Count number of text values in a specific row Carlee Excel Worksheet Functions 3 June 7th 07 11:47 PM
count number of text in a column Daniel_ITSM[_2_] Excel Discussion (Misc queries) 7 March 7th 07 08:05 PM
count number of times text appears MMcQ Excel Discussion (Misc queries) 3 February 9th 07 07:33 PM
count number of specified text within a text/cell Vikas Kumar Excel Discussion (Misc queries) 4 October 11th 06 12:43 PM
how do I count the number of times text in column A matches text i Sheila Excel Worksheet Functions 2 November 16th 05 10:20 PM


All times are GMT +1. The time now is 12:10 AM.

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

About Us

"It's about Microsoft Excel"