Cell Prefix Suffix
abcd041 abcd 041
qjwxkl678 qjwxkl 678
abc1455 abc 1455
Thanks for any help on this.
Sub split_um()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
Cells(i, "B").Value = ""
Cells(i, "C").Value = ""
v = Cells(i, "A").Value
For j = 1 To Len(v)
ch = Mid(v, j, 1)
If IsNumeric(ch) Then
Cells(i, "C").Value = Cells(i, "C").Value & ch
Else
Cells(i, "B").Value = Cells(i, "B").Value & ch
End If
Next
Next
End Sub
--
Gary''s Student - gsnu200768
=LEFT(A2,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"))-1)
and put this formula in your Suffix column...
=RIGHT(A2,LEN(A2)-MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"))+1)
and copy down as needed.
Rick
"Keith S" <Kei...@discussions.microsoft.com> wrote in message
news:5977D9E4-135B-42D6...@microsoft.com...
This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)
Put this in B1:
=LEFT(A1,D1-1)
Put this in C1:
=MID(A1,D1,255)
Select B1:D1
and drag down your range.
Select B:D
Edit|copy
Edit|Paste special|values
Delete column D.
--
Dave Peterson
Prefix Cell
============
=IF(A2="","",LEFT(A2,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"))-1))
Suffix Cell
============
=IF(A2="","",RIGHT(A2,LEN(A2)-MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"))+1))
Rick
"Rick Rothstein (MVP - VB)" <rick.new...@NO.SPAMverizon.net> wrote in
message news:u%23bFXrra...@TK2MSFTNGP06.phx.gbl...
You already got some suggestions.
I find regular expressions quite helpful:
Enter into B1
=RegExpReplace(A1,"(\D*)(\d*).*","$1")
And into C1
=RegExpReplace(A1,"(\D*)(\d*).*","$2")
for example.
The UDF you can find here:
http://www.sulprobil.com/html/regexp.html
Regards,
Bernd