View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
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