How to extract the first number from a excel cell containing multiple numbers

narayani

New Member
Joined
Jul 30, 2014
Messages
6
Hi,

I need to extract the first number from a excel cell containing more than one number. For eg, in this case,
"abc 1234 pc5678999" - i want to show only 1234 in the next cell. I applied one formula which I got from one of the forums - =1*MID(A1,MATCH(TRUE,ISNUMBER(1*MID(A1,ROW($1:$18),1)),0),COUNT(1*MID(A1,ROW($1:$18),1))) but this does not work in this case as there is another set of number given after 1234.

Can anyone help me as to how the above formula can be modified or is there any other formula which I can apply?

<tbody>
</tbody>
 
Ah, yes. Of course. Jonmo forgot to make one of the references absolute. Should be:

=LOOKUP(9.99999999999999E+307,MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW(
$A$1:INDEX(A:A,LEN(A1))))+0)

and then copied down.

Regards
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,

Yes it is working now for all the cells, great!!!

Thanks a lot for your help. My work has become much simpler now because of this formula.. Have a nice day!!
 
Upvote 0
narayani,

If the following is your present situation, what number(s) should be the correct result(s) in the YELLOW cells?


Excel 2007
ABC
1ABC SJB302 7528051084326015SO302
2ABC SJB 446446
3ABC N 5PL F SJB 466#N/A
4ABC APM&SJ SJB 776 5944485374322016SO776
5ABC CG SJB 9 0175595584322014SO#N/A
6ABC CARMEL SJB/405 FP14097O51938042#N/A
7ABC SJB302 7528051084326015SO#N/A
8ABC N L SJB453 36023546483743000N#N/A
9ALS SJB8 RP4671464307371300#N/A
10A BC 930 RP4671663922856500#N/A
11ABC-SM 458 00156460632BBBVHBP#N/A
12ABC 798 RP4672163833173200#N/A
13ABC PTA 00453599453599
Sheet1
 
Upvote 0
Hi,
The answers which i want to get by applying the lookup formula is given in the third column. Only the result in the 3rd row is an exception as I want to get 466 as my result but it will show 5 as it is the first number reflected. However on applying the revised lookup formula, my problem is solved for rest of the cases.
ABC SJB302 7528051084326015SO302
ABC SJB 446446
ABC N 5PL F SJB 466#N/A466
ABC APM&SJ SJB 776 5944485374322016SO776
ABC CG SJB 9 0175595584322014SO#N/A9
ABC CARMEL SJB/405 FP14097O51938042#N/A405
ABC SJB302 7528051084326015SO#N/A302
ABC N L SJB453 36023546483743000N#N/A453
ALS SJB8 RP4671464307371300#N/A8
A BC 930 RP4671663922856500#N/A930
ABC-SM 458 00156460632BBBVHBP#N/A458
ABC 798 RP4672163833173200#N/A798
ABC PTA 00453599453599

<tbody>
</tbody>
 
Upvote 0
This formula extracts what you need, including row 3 containing „5PL”:

=LOOKUP(10^10,MID(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9}&" ",A1&" 0 1 2 3 4 5 6 7 8 9 "))-{0,1,2,3,4,5,6,7,8,9},{1,2,3,4,5,6,7,8,9,10})+0)
Excel Workbook
AB
1ABC SJB302 7528051084326015SO302
2ABC SJB 446446
3ABC N 5PL F SJB 466466
4ABC APM&SJ SJB 776 5944485374322016SO776
5ABC CG SJB 9 0175595584322014SO9
6ABC CARMEL SJB/405 FP14097O51938042405
7ABC SJB302 7528051084326015SO302
8ABC N L SJB453 36023546483743000N453
9ALS SJB8 RP46714643073713008
10A BC 930 RP4671663922856500930
11ABC-SM 458 00156460632BBBVHBP458
12ABC 798 RP4672163833173200798
13ABC PTA 00453599453599
14ABC PTA 00453599DR 123456789123456789
15930 ere w 345r930
Sheet
 
Upvote 0

Forum statistics

Threads
1,216,484
Messages
6,130,936
Members
449,608
Latest member
jacobmudombe

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