Separate Numbers from text

undemane

Board Regular
Joined
Nov 19, 2007
Messages
75
In column A, I have cells with text and numbers (example: abc12446, xyz14456, etc.). I want to separate these into column B cell with abc, and another column with 12446 in it. How do I do this?
 
Is it always three letters followed by five digits?
 
Upvote 0
Do you want the numbers as a string (Column C) or as a number (Column D):


Book1
ABCD
1abc12446abc1244612446
2monkeys001monkeys0011
3xyz14456xyz1445614456
Sheet1
Cell Formulas
RangeFormula
B1=LEFT($A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},$A1&"0123456789"))-1)
C1=MID($A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},$A1&"0123456789")),LEN($A1))
D1=MID($A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},$A1&"0123456789")),LEN($A1))+0


WBD
 
Upvote 0
Do you want the numbers as a string (Column C) or as a number (Column D):
Simpler for C & D would be
=SUBSTITUTE(A1,B1,"")
=SUBSTITUTE(A1,B1,"")+0


Though it would be good to know the answer to yky's question and how consistent/varied the data actually is.
 
Last edited:
Upvote 0
The letters can be 3 or more characters. Not consistent.

As above then:


Book1
ABCD
1abc12446abc1244612446
2monkeys001monkeys0011
3xyz14456xyz1445614456
4a2a22
Sheet1
Cell Formulas
RangeFormula
B1=LEFT($A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},$A1&"0123456789"))-1)
C1=SUBSTITUTE($A1,$B1,"")
D1=SUBSTITUTE($A1,$B1,"")+0


WBD
 
Upvote 0
The letters can be 3 or more characters. Not consistent.
What about the Numbers? That could be usefull if it's known that it's always 5 numbers at the end.

In that case you could do this


Unknown
ABC
1abc12446abc12446
2vwxyz14456vwxyz14456
Sheet1
Cell Formulas
RangeFormula
B1=SUBSTITUTE(A1,C1,"")
B2=SUBSTITUTE(A2,C2,"")
C1=RIGHT(A1,5)+0
C2=RIGHT(A2,5)+0
 
Upvote 0
...if it's known that it's always 5 numbers at the end.

In that case you could do this
[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10, bgcolor: #DAE7F5"]B1[/TH]
[TD="align: left"]=SUBSTITUTE(A1,C1,"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
If you are right about the number always being 5 digits, then I think I would use this formula instead of the one above (my gut tells me LEFT and LEN should be more efficient functions than SUBSTITUTE)...

=LEFT(A1,LEN(A1)-5)
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top