Retrieve only numbers from a cell

cherambane

New Member
Joined
May 4, 2011
Messages
20
Dear All,

I want to know any function to retrieve only numbers from a cell containing alphanumeric values.

Ex:

B1 = KAR000712
B2 = KA01234
B3 = A/C 112245

I want only 000712, 01234, 112245 etc.,


any formula???


Thanks and Regards,

Basheer
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Dear All,

I want to know any function to retrieve only numbers from a cell containing alphanumeric values.

Ex:

B1 = KAR000712
B2 = KA01234
B3 = A/C 112245

I want only 000712, 01234, 112245 etc.,


any formula???


Thanks and Regards,

Basheer
This assumes that the number string will always be at the end of the string.

Also, in order to retain any leading zeros the strings will have to be extracted as TEXT strings.

Book1
BC
1KAR000712000712
2KA0123401234
3A/C 112245112245
Sheet2

Formula entered in C1 and copied down:

=REPLACE(B1,1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},B1&"0123456789"))-1,"")
 
Upvote 0
Two shorter ways :

=REPLACE(B1,1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},B1&5^19))-1,"")

or,

=REPLACE(B1,1,MATCH(,INDEX(0*MID(B1,ROW($1:$99),1),),)-1,"")

Regards
 
Upvote 0
Two shorter ways :

=REPLACE(B1,1,MATCH(,INDEX(0*MID(B1,ROW($1:$99),1),),)-1,"")

Regards
Could i ask please ?
in MATCH you leave the lookup value empty, for what MATCH will search
and the same thing you did in INDEX , You leave The row_num Empty what is the defult value in this case
 
Upvote 0
This Name based approach handles letters anywhere in the string.
If your mixed strings are in column A:

Select E1 and define these names.
(The relative referencing makes the active cell critical.)

Name: oneToNCol
RefersTo: =INDEX(Sheet1!E:E, 1, 1):INDEX(Sheet1!E:E, LEN(Sheet1!$A1), 1)

Name: oneToNRow
RefersTo: =INDEX(Sheet1!1:1, 1, 1):INDEX(Sheet1!1:1, 1, LEN(Sheet1!$A1))

Name: subStrings
RefersTo: =MID(Sheet1!$A1, COLUMN(oneToNRow), ROW(oneToNCol))

Then put this CSE formula in C1 and drag down.
=MAX(IFERROR(VALUE(subStrings),0))

<table border=1 cellspacing=0>
<tr align="center" bgcolor=#A0A0A0><td width=25> <td width=25><b>A</b><td width=25><b>B</b><td width=25><b>C</b></tr>
<tr><td align="center" bgcolor=#A0A0A0><b>1</b><td align="left" bgcolor=#FFFFFF>KAR000712<td align="left" bgcolor=#FFFFFF><td align="right" bgcolor=#FFFFFF>712</tr>
<tr><td align="center" bgcolor=#A0A0A0><b>2</b><td align="left" bgcolor=#FFFFFF>KA01234<td align="left" bgcolor=#FFFFFF><td align="right" bgcolor=#FFFFFF>1234</tr>
<tr><td align="center" bgcolor=#A0A0A0><b>3</b><td align="left" bgcolor=#FFFFFF>A/C 112245<td align="left" bgcolor=#FFFFFF><td align="right" bgcolor=#FFFFFF>112245</tr>
<tr><td align="center" bgcolor=#A0A0A0><b>4</b><td align="left" bgcolor=#FFFFFF>abc123xyz23t<td align="left" bgcolor=#FFFFFF><td align="right" bgcolor=#FFFFFF>123</tr>
<tr><td align="center" bgcolor=#A0A0A0><b>5</b><td align="left" bgcolor=#FFFFFF>ab123xy456.3f<td align="left" bgcolor=#FFFFFF><td align="right" bgcolor=#FFFFFF>456.3</tr>
</table>
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,408
Members
452,912
Latest member
alicemil

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