Text extraction

mrh15

New Member
Joined
Oct 20, 2003
Messages
30
I have data like this in column a

Butter SO SOFT 500G P/M


How to extract the "500" value - i.e. the 3 numbers before the G?

Any help is much appreciated
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try...

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

Hope this helps!
 
Upvote 0
Actually, if the number is always 3 digits in length, the following would suffice...

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),3)+0

Hope this helps!
 
Upvote 0
That is immense!!!

One small point - it does not work for these:

Butter smaller 5 X 100G
 
Upvote 0
If the letter 'G' always follows a three digit number, try...

=MID(A1,FIND("G ",A1&" ")-3,3)

If the number is always 3 digits in length, try...

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789",IF(ISNUMBER(SEARCH(" x ",A1)),SEARCH(" x ",A1),1))),3)

Otherwise, try...

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

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,215,242
Messages
6,123,830
Members
449,127
Latest member
Cyko

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