Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Count Number or words in Cell

Is there a way to count the number of words in just a cell? If so,
how?

Thanks
Samantha

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Count Number or words in Cell

If the words are separated by a single space then you can compare the
length of the cell with the length of the cell after spaces have been
removed and add one. Like this:

=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1

If you had "Mary had a lamb" in A1, then this formula will return 4.

Hope this helps.

Pete


On Aug 15, 2:39 pm, wrote:
Is there a way to count the number of words in just a cell? If so,
how?

Thanks
Samantha



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default Count Number or words in Cell

With the assumption that each word is separated by only one (1) space with
no spaces at the beginning or at the end, then you could use the following
formula.

=(LEN(A1)-LEN(SUBSTITUTE(A1," ","")))+1

HTH,
Paul

--

wrote in message
ups.com...
Is there a way to count the number of words in just a cell? If so,
how?

Thanks
Samantha



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Count Number or words in Cell

Paul,

use TRIM to try to enforce your assumptions.

Pete

On Aug 15, 2:49 pm, "PCLIVE" wrote:
With the assumption that each word is separated by only one (1) space with
no spaces at the beginning or at the end, then you could use the following
formula.

=(LEN(A1)-LEN(SUBSTITUTE(A1," ","")))+1

HTH,
Paul

--

wrote in message

ups.com...



Is there a way to count the number of words in just a cell? If so,
how?


Thanks
Samantha- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,311
Default Count Number or words in Cell

Thanks Pete. I should have thought of that.

--

"Pete_UK" wrote in message
ps.com...
Paul,

use TRIM to try to enforce your assumptions.

Pete

On Aug 15, 2:49 pm, "PCLIVE" wrote:
With the assumption that each word is separated by only one (1) space
with
no spaces at the beginning or at the end, then you could use the
following
formula.

=(LEN(A1)-LEN(SUBSTITUTE(A1," ","")))+1

HTH,
Paul

--

wrote in message

ups.com...



Is there a way to count the number of words in just a cell? If so,
how?


Thanks
Samantha- Hide quoted text -


- Show quoted text -







  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Count Number or words in Cell

On Wed, 15 Aug 2007 06:45:33 -0700, Pete_UK wrote:

If the words are separated by a single space then you can compare the
length of the cell with the length of the cell after spaces have been
removed and add one. Like this:

=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1

If you had "Mary had a lamb" in A1, then this formula will return 4.

Hope this helps.

Pete


And your formula would also return 1 with a blank cell. You need to test for
it.
--ron
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Count Number or words in Cell

But to avoid returning 1 when the cell is empty:

=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+(TRIM(A1)<"")

wrote:

Is there a way to count the number of words in just a cell? If so,
how?

Thanks
Samantha


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Count Number or words in Cell

Thanks for pointing that out, Ron. I see that Dave has come up with a
way of coping with an empty cell.

Pete

On Aug 15, 3:06 pm, Ron Rosenfeld wrote:
On Wed, 15 Aug 2007 06:45:33 -0700, Pete_UK wrote:
If the words are separated by a single space then you can compare the
length of the cell with the length of the cell after spaces have been
removed and add one. Like this:


=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1


If you had "Mary had a lamb" in A1, then this formula will return 4.


Hope this helps.


Pete


And your formula would also return 1 with a blank cell. You need to test for
it.
--ron



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
How to convert Number into words in EXCEL same or a new cell ? Rao AM Excel Worksheet Functions 8 February 26th 09 05:56 PM
Is it possible to count specific words in a number of cells? theboytree Excel Discussion (Misc queries) 1 June 15th 06 09:29 AM
How do I count the number of words in a cell? Phil Excel Worksheet Functions 3 May 2nd 06 07:13 PM
Is there a limit to number of words in a cell in excel? rampam1 Excel Discussion (Misc queries) 1 January 23rd 05 06:07 PM
Count the number of words in a cell! Doom3 Excel Worksheet Functions 4 November 23rd 04 06:00 AM


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