View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Split astring using Capital letter as identifier

Thank you for your remarks!
Stefi


€˛Rick Rothstein€¯ ezt Ć*rta:

You might need to expand your test... just testing for <91 makes your code
treat most punctuation marks and digits as if they were upper case letters.
Think names like (FOX News host) BillO'Reilly or (when she was married to
Lee Majors) FarrahFawcett-Majors.

Just as an aside, concatenating *each* letter to make the string value is
not as efficient as just handling the concatenations at the required break
points (see the other posting in this thread for examples). If the UDF is to
be used a great many times in the OP's spreadsheet, the extra overhead in
your method might begin to show up as a slower spreadsheet recalculations.

--
Rick (MVP - Excel)


"Stefi" wrote in message
...
Try this UDF:

Function splitcap(wholestr)
splitstr = ""
For i = 1 To Len(wholestr)
currchr = Mid(wholestr, i, 1)
splitstr = splitstr & IIf(Asc(currchr) < 91 And i 1, " ", "") &
currchr
Next i
splitcap = splitstr
End Function

Regards,
Stefi


€˛Raj€¯ ezt Ć*rta:

Hi,

I am looking for a formula/function/UDF that would split
VasantRamPatil into Vasant Ram Patil ( ie split the string into three
words using the capital letter as the initial letter of each word).
The split can be either by inserting spaces inside the string itself
or splitting the string into three strings).

Thanks in advance for the Help.

Regards,
Raj