Extract specific number from alphanumeric string

Gfletch63

New Member
Joined
Mar 2, 2018
Messages
6
Here is a sample string from a cell in my spreadsheet:

PTG X 4 / 60 MINS UNLD

I need to grab the 60 out of that string. The word MIN or MINS is always to the right of the number, and the number is always either 2 or 3 digits.

Sounds like it should be simple, but...not for me.

<tbody>
</tbody>
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
This seems enough:

=MID(" "&A1,SEARCH("MIN"," "&A1)-4,4)+0

Thanks, that works, too. I'm not sure yet, but it may be more flexible for use with some other things. Gonna work with both of these, depends a lot on my ability to understand the logic, of course.
 
Upvote 0
Hi, I initially started by using the MID function also, but encountered Errors if incase the User did not enter a Space before MIN:


Book1
ABCD
1PTG X 4 / 60MINS UNLD60#VALUE!
285 MINS UNLD ( 1 HR 25 MINS)8585
3185MINS UNLD ( 3 HR 5 MINS)185185
450 MINS UNLD5050
599MIN ABCD99#VALUE!
6DEL APPT / 29 MINS UNLD2929
Sheet7
Cell Formulas
RangeFormula
C1=RIGHT(TRIM(LEFT(A1,SEARCH("MIN",A1)-1)),3)+0
D1=MID(" "&A1,SEARCH("MIN"," "&A1)-4,4)+0
 
Last edited:
Upvote 0
Here is a modification to István's formula that appears to work...

=MID(" "&TRIM(SUBSTITUTE(A1,"MIN"," MIN")),SEARCH("MIN"," "&TRIM(SUBSTITUTE(A1,"MIN"," MIN")))-4,4)+0
 
Upvote 0

Forum statistics

Threads
1,215,873
Messages
6,127,451
Members
449,383
Latest member
DonnaRisso

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