View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Wigi Wigi is offline
external usenet poster
 
Posts: 396
Default How to tally words in Excel?

Hi

Here's a VBA approach:

Function CountWordsCell(s As String)

Dim a As Variant

a = Split(Trim(s))

CountWordsCell = UBound(a) + 1

End Function

Paste this function into a new module.

You can then use this function anywhere in your sheet.

You use it like:

=CountWordsCell(C7)


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Ron Rosenfeld" wrote:

On Sat, 11 Aug 2007 06:46:00 -0700, Looking for answers <Looking for
wrote:



Count the spaces; add one (1)

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