# Split mixed string in excel.

I have an intractable problem. There is this huge, long column at work which contains mixed strings with the following format:

ue6584
th45
hur4562243
So it is very irregular, the only regularity is that it starts with letters and ends with numbers. I need to split the strings in each cell so that:

ue6584             —> ue 6584
th45                 —> th 45
hur4562243     —> hur 4562243
So the cell splits into two columns, one column containing the letters only, the other the numbers only. So far, I am thinking this is impossible to do in excel.

###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Older than dirtCommented:
Place this code in a code module like Module1.

``````Function TwoColumns(r As Range, intPart As Integer) As String
Dim intChar As Integer

If intPart = 1 Then
For intChar = 1 To Len(r)
If IsNumeric(Mid\$(r, intChar, 1)) Then
Exit Function
Else
TwoColumns = TwoColumns & Mid\$(r, intChar, 1)
End If
Next
Else
For intChar = 1 To Len(r)
If IsNumeric(Mid\$(r, intChar, 1)) Then
TwoColumns = TwoColumns & Mid\$(r, intChar, 1)
End If
Next
End If
End Function
``````
Assuming the data is in column "A" and you want the results in "B" and "C" then
Usage for "B":
= TwoColumns(A1,1)
Usage for "C":
= TwoColumns(A1,2)

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Older than dirtCommented:
The "2" in the formula for column "C" could actually be any number other than 1.
Commented:
With value in A1.
Text
``````=LEFT(A1,SEARCH(RIGHT(A1,LEN(A1)-MIN(FIND(0,SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9},0)&0))+1),A1)-1)
``````
Number, array formula, insert with Ctrl+Shift+Enter
``````=NPV(-0.9,IFERROR(MID(A1,1+LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))),1)/10,""))
``````
See file
Dritan-split-text-and-numbers.xlsx
IT / Software Engineering ConsultantCommented:
You can use the same technique demonstrated here:

»bp
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.