View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Count tokens in a string

Hi Robert,

Am Wed, 25 May 2011 13:03:31 -0700 schrieb Robert Crandal:

myVar = "Todd Jones" ' 2 tokens
myVar = "Mary Jo Lynn Jackson" ' 4 tokens
myVar = "Peter James Smith Jr." ' 4 tokens

What is a good way to get the COUNT of the number
of tokens in my string?


try:
=LEN(myVar)-LEN(SUBSTITUTE(myVar," ",))+1


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2