How to extract number is a string of text?

wkirkcrawford

Board Regular
Joined
Dec 7, 2013
Messages
72
Greetings,

This is my string; LANTUS 24 Units in the Morning, 18 Units + HUMLOG at Dinner Time.

I need to extract the numbers, 24 and 18.

I've seen all kinds of answers, including VBA, which isn't for me.

W. Kirk Crawford
Tularosa, New Mexico
 
Ver.#, Microsoft 365 MSO (16.0.13530.20054) 32-bit
Please put this information in your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

1612315930655.png


If you are interested, here are a couple of slightly shorter options that you might like to also try.
Note that these formulas (and those of jtakw) rely on the word "Units" in your text being exactly like that and not "UNITS", "units" etc. For my formulas, if the case of "Units" could vary, change each FIND function to SEARCH.

21 02 03.xlsm
ABCD
9LANTUS 24 Units in the Morning, 18 Units + HUMLOG at Dinner Time.24
1018
Extract Nums
Cell Formulas
RangeFormula
B9B9=IFERROR(AGGREGATE(14,6,RIGHT(LEFT(A9,FIND("Units",A9)-1),SEQUENCE(20))+0,1),"")
D10D10=IFERROR(AGGREGATE(14,6,RIGHT(LEFT(A9,FIND("Units",A9,FIND("Units",A9)+1)-1),SEQUENCE(20))+0,1),"")
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,223,886
Messages
6,175,190
Members
452,616
Latest member
intern444

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