View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\)[_725_] Rick Rothstein \(MVP - VB\)[_725_] is offline
external usenet poster
 
Posts: 1
Default Reverse Concatenation (Splitting Single Cell Data into Multiple Ce

You didn't give us the "rule" for the rest of your splits, but to answer the
question you asked... you would use the LEFT function. Its syntax is

=LEFT(TextString,NumberOfCharacterFromLeftToGet)

So, if your data is in A1, then the leftmost 3 characters would be
=LEFT(A1,3). There is an equivalent RIGHT function if you know how many
characters you want to get from the rightside of the text string. To get a
variable number of characters from anywhere within the text string, you
would use the MID function. Its syntax is this...

=MID(TextString,StartPosition,NumberOfCharacters)

So, if you wanted the internal 3 characters starting at character position
4, you would use =MID(A1,4,3). To get the remainder of the text string
starting at, say, character position 5, you could to this...

=MID(A1,5,LEN(A1)-4)

where the 4 in the subtraction is one less than the start position. Most
people, though, would simply do something like this instead....

=MID(A1,5,99)

where, knowing the structure of their data, they would substitute for my
example length number of 99 a number larger than the maximum possible length
of the text string being parsed.

Rick


"SirEric" wrote in message
...
Good Sirs & Madams:

Please help me with my excel question. Thank you in advance.

1002bat
2003cat
3009dog
4005frog
5003snake

I want to take single cell data and split the contents into multiple
cells.

"1002bat" would become "100", "2", "Bat".

The way our information is "imported" into excel results in the
concatenation of data that would be useful to be split.

Is there a macro that can take the first "x" digits/text" of a long string
in order to accomplish this separation.

Thanks,

Sir Eric
(Queen's Knight)