Extract Numbers from a String of Text

bobzy20

New Member
Joined
Feb 5, 2018
Messages
47
Office Version
  1. 2010
Hi

I hope somebody can help me with this.

I’m looking for a way to extract a 7 digit number from a string of text, see my examples below. The number could be anywhere in the string.

Sanyo Yamaha II Slow Control Rod NEW 5841258 25984
Sanyo 4579542 Yamaha II Slow Controller NEW 12584
Sanyo Yamaha II Plastic Bag NEW 1248652 25489
Sanyo Yamaha II 9405566 Tool Bag NEW / 5894526
Sanyo Yamaha II/Super Car 1257945 Screw Bag C NEW 25689
Sanyo Yamaha Metal Parts 1584520 Bag NEW 56974

Thanks

Bob
 
That is (partly) why I qualified my post with "IF the sample data was representative of the real data". All the sample data examples contained a 7-digit number surrounded by spaces & also no numbers greater than 7 digits. Your example is different to the OP's samples on the first point. :)


In that case, does this work? If not, could you give a more representative set of sample data and the expected results?

=MID(AGGREGATE(14,6,(9&MID(A1,ROW(INDIRECT("1:"&LEN(A1)-6)),7))+0,1),2,7)

Thanks, I will try and let you know.

Bob
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Works perfectly, thanks very much.

How many years have you been using Excel as all I really use is VLOOKUP!

Bob
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,022
Latest member
RobertV1609

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