Extracting numbers before a certain word or symbol in a long string of Text.

pjaywon

New Member
Joined
Aug 30, 2019
Messages
1
Hi. I am looking to extract several numbers from a string of text like the following:

"For the period beginning January 1, 2018, Supplier's fees for Services may be increased annually effective each January 1 upon 60 days prior notice to Customer. Any increase shall be based on actual increases in Supplier's costs, will not include mark-up and the increase shall be limited to the increase in the U.S. Department of Labor, Consumer Price Index for All Urban Consumers ("CPI") for the most recently available 12-month period preceding such 60-day notice period, or 2.0%, whichever is less."

In the above paragraph, I'd like to extract the "60" before "days" and the "2.0" before the "%" symbol into separate cells.

Can someone help me with this? I have over 12,000 cells of text that are similar, but not exactly like this paragraph and I'd like to get this information isolated into those cells.

Thanks!!!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the MrExcel board!

See if this is any help. It assumes that the original cell(s) all do contain the text " days" and "%" & they are immediately after the relevant numbers.
I have provided two options for the 5. If you want the result as a number use the C2 formula (you could format the column for decimal places if you want) but if you want the exact format "2.0" then use the D2 formula but note that result is a text value, not numerical.

Excel Workbook
ABCD
1Days%
2For the period beginning January 1, 2018, Supplier's fees for Services may be increased annually effective each January 1 upon 60 days prior notice to Customer. Any increase shall be based on actual increases in Supplier's costs, will not include mark-up and the increase shall be limited to the increase in the U.S. Department of Labor, Consumer Price Index for All Urban Consumers ("CPI") for the most recently available 12-month period preceding such 60-day notice period, or 2.0%, whichever is less.6022.0
Extract Numbers
 
Last edited:
Upvote 0
Or try:

=-LOOKUP(1,-MID(A2,SEARCH(" days",A2)-{1,2,3,4,5,6},{1,2,3,4,5,6}))
 
Last edited:
Upvote 0
Or try:

=-LOOKUP(1,-MID(A2,SEARCH(" days",A2)-{1,2,3,4,5,6},{1,2,3,4,5,6}))
Probably unlikely with the OP's data, but that 'could' return an incorrect result
"If I may 2 days will be set aside"
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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