Thread: Split Text
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Split Text

On Tue, 12 Sep 2006 00:41:02 -0700, Carlo
wrote:

Hi all

i'm trying to split a text, actually a real easy task, excel provides the
split
function! But what if I want Excel to use each character as a substring??
i.e. "Hello" == "H","e","l","l","o"

Is this possible?

I want to make a function which returns me a string, with a space between
every character: "Hello" == "H e l l o"
If I could split up the string, i could join it again, and put a space
between each
character. Possibly there's another / better solution for my problem, if so,
i would be real glad if you could tell me :)

Thanks a lot for everything

Cheers Carlo


Here's another approach using regular expressions:

Download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr

Then use this formula:

=REGEX.SUBSTITUTE(A1,"(.(?!$))","[1] ")

The translation of that formula is

"(.(?!$))" Find every character except the last character

"[1] " Replace that character with itself followed by a <space.


--ron