Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Finding the number of times a word is used in a range of cells

I have a column of cells in Excel 2000 with place names in them, such as
Phoenix, Arizona; White Plains, New York; Carson City, Nevada; Dayton, Ohio;
etc. Each cell usually contains two words, city and state, separated by a
comma. Although sometimes it's more than two words if the city and/or state
is two words, such as Carson City or New York.

What function and syntax would I use to find the number of times, say,
Arizona is used in the range of cells?

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,240
Default Finding the number of times a word is used in a range of cells

Ray Hill wrote:
I have a column of cells in Excel 2000 with place names in them, such as
Phoenix, Arizona; White Plains, New York; Carson City, Nevada; Dayton, Ohio;
etc. Each cell usually contains two words, city and state, separated by a
comma. Although sometimes it's more than two words if the city and/or state
is two words, such as Carson City or New York.

What function and syntax would I use to find the number of times, say,
Arizona is used in the range of cells?

Thanks.



Assuming your data is in A1:A100 and "Arizona" is in B1, put this in C1:

=COUNTIF(A1:A100,"*"&B1&"*")
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Finding the number of times a word is used in a range of cells

To keep it simple, let's say my data is in cells L8 through L100. Say I want
to find the number of times Arizona is used in those cells. Each cell has at
least two words in it. What do I say?

"Glenn" wrote in message
...
Ray Hill wrote:
I have a column of cells in Excel 2000 with place names in them, such as
Phoenix, Arizona; White Plains, New York; Carson City, Nevada; Dayton,
Ohio; etc. Each cell usually contains two words, city and state,
separated by a comma. Although sometimes it's more than two words if the
city and/or state is two words, such as Carson City or New York.

What function and syntax would I use to find the number of times, say,
Arizona is used in the range of cells?

Thanks.


Assuming your data is in A1:A100 and "Arizona" is in B1, put this in C1:

=COUNTIF(A1:A100,"*"&B1&"*")



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Finding the number of times a word is used in a range of cells

Actually I solved my own problem. Using the example below the syntax is:

=COUNTIF(L8:L100,"*Arizona*")

Thanks for the effort.

"Ray Hill" wrote in message
...
To keep it simple, let's say my data is in cells L8 through L100. Say I
want to find the number of times Arizona is used in those cells. Each cell
has at least two words in it. What do I say?

"Glenn" wrote in message
...
Ray Hill wrote:
I have a column of cells in Excel 2000 with place names in them, such as
Phoenix, Arizona; White Plains, New York; Carson City, Nevada; Dayton,
Ohio; etc. Each cell usually contains two words, city and state,
separated by a comma. Although sometimes it's more than two words if the
city and/or state is two words, such as Carson City or New York.

What function and syntax would I use to find the number of times, say,
Arizona is used in the range of cells?

Thanks.


Assuming your data is in A1:A100 and "Arizona" is in B1, put this in C1:

=COUNTIF(A1:A100,"*"&B1&"*")





  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,073
Default Finding the number of times a word is used in a range of cells

One thing to keep in mind about using COUNTIF with the * wildcard is
that it doesn't actually count the instances of "Arizona" in L8:L100,
it only counts the cells with one or more instances of "Arizona". So,
if any of your cells have for example "Arizona Arizona" each such cell
will only add 1 to the count instead of 2.

If you need to count all the instances of "Arizona" in L8:L100 you
could use this array formula...
=SUM(LEN(L8:L100)-LEN(SUBSTITUTE(L8:L100,"Arizona","")))/LEN
("Arizona")

Since it is an array formula it needs to be entered using Ctrl+Shift
+Enter when added to the sheet as well as after each time has been
edited.

Ken Johnson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Finding the number of times a word is used in a range of cells

Thanks Ken. That's good to know. In my situation there is only one instance
of the word in each cell. But I'll file that bit of code away for future use
if I need it.

"Ken Johnson" wrote in message
...
One thing to keep in mind about using COUNTIF with the * wildcard is
that it doesn't actually count the instances of "Arizona" in L8:L100,
it only counts the cells with one or more instances of "Arizona". So,
if any of your cells have for example "Arizona Arizona" each such cell
will only add 1 to the count instead of 2.

If you need to count all the instances of "Arizona" in L8:L100 you
could use this array formula...
=SUM(LEN(L8:L100)-LEN(SUBSTITUTE(L8:L100,"Arizona","")))/LEN
("Arizona")

Since it is an array formula it needs to be entered using Ctrl+Shift
+Enter when added to the sheet as well as after each time has been
edited.

Ken Johnson



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
counting the number of times a word appears Adrienne[_2_] Excel Worksheet Functions 5 September 5th 07 02:49 AM
number of times consective data occurs in a range of cells Thanks a lot Ralph. it worked. Excel Worksheet Functions 10 June 21st 07 05:21 AM
Finding Number of cells in a column of other sheet having a specific word in them [email protected] New Users to Excel 5 February 21st 07 01:51 PM
finding a number and the number of times it occurs luposlipophobia Excel Discussion (Misc queries) 3 June 22nd 06 03:51 AM
how do I count the number of times a word is repeated in a range? sol Excel Discussion (Misc queries) 3 July 14th 05 01:53 PM


All times are GMT +1. The time now is 03:26 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"