#1   Report Post  
Posted to microsoft.public.excel.misc
kckar
 
Posts: n/a
Default count function


if i have a paragraph in one cell
and want to count the number of words in the paragraph, what do i do

say the cell has the following "I went to the school today. School was
fun." all in a1,

how do i count the number of times school is in a1?


--
kckar
------------------------------------------------------------------------
kckar's Profile: http://www.excelforum.com/member.php...o&userid=25322
View this thread: http://www.excelforum.com/showthread...hreadid=512954

  #2   Report Post  
Posted to microsoft.public.excel.misc
daddylonglegs
 
Posts: n/a
Default count function


Try

=(LEN(A1)-LEN(SUBSTITUTE(A1,"school","")))/6

The 6 is the length of the word for which you're searching, if you put
your search word in a cell, say C2

=(LEN(A1)-LEN(SUBSTITUTE(A1,C2,"")))/LEN(C2)


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=512954

  #3   Report Post  
Posted to microsoft.public.excel.misc
kckar
 
Posts: n/a
Default count function


wouldnt that count all 2 letter words such as "is" and "it" instead of
just counting "it"

or all words that have seven letters instead of just counting how many
times school shows up


--
kckar
------------------------------------------------------------------------
kckar's Profile: http://www.excelforum.com/member.php...o&userid=25322
View this thread: http://www.excelforum.com/showthread...hreadid=512954

  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default count function

No because it specifically looks for the text 'school', not just any old 6
character string. It just divides by 6 as the first part of the formula
counts the number of characters taken up by the word school (12 if there are
2), and so needs to divide by the length of the search.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"kckar" wrote in
message ...

wouldnt that count all 2 letter words such as "is" and "it" instead of
just counting "it"

or all words that have seven letters instead of just counting how many
times school shows up


--
kckar
------------------------------------------------------------------------
kckar's Profile:

http://www.excelforum.com/member.php...o&userid=25322
View this thread: http://www.excelforum.com/showthread...hreadid=512954



  #5   Report Post  
Posted to microsoft.public.excel.misc
Steve Yandl
 
Posts: n/a
Default count function

You might set up a user defined function like:

_ _ _ _ _ _ _ _ _ _

Function CountWdInstances(rngA As Range, strSeek As String) As Integer
arrayWords = Split(LCase(rngA.Text))
arrFilteredList = Filter(arrayWords, strSeek)
CountWdInstances = UBound(arrFilteredList) + 1
End Function
_ _ _ _ _ _ _ _ _ _


Now, if you use
=CountWdInstances(A1, "school")
You should get the number of times "school" appears in the range. If you
want it to be case sensitive, drop the LCase inside the Split function.

Steve Yandl


"kckar" wrote in
message ...

if i have a paragraph in one cell
and want to count the number of words in the paragraph, what do i do

say the cell has the following "I went to the school today. School was
fun." all in a1,

how do i count the number of times school is in a1?


--
kckar
------------------------------------------------------------------------
kckar's Profile:
http://www.excelforum.com/member.php...o&userid=25322
View this thread: http://www.excelforum.com/showthread...hreadid=512954





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 function not working, keeps displaying 0 dnm Excel Worksheet Functions 5 April 3rd 23 07:32 PM
Function to count unique values? Richard Buttrey Excel Worksheet Functions 5 September 22nd 05 02:58 PM
clock Wildman Excel Worksheet Functions 2 April 26th 05 10:31 AM
Count If Function Michele Excel Worksheet Functions 3 April 25th 05 02:31 PM
count if function with if statements Natalia Excel Worksheet Functions 3 April 22nd 05 02:52 AM


All times are GMT +1. The time now is 07:15 AM.

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"