Separating/sorting numbers from text

Ian1976

Board Regular
Joined
Feb 4, 2016
Messages
137
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a column (F1:F90) which will have either "service due in 9235mi" or "service overdue by 14755mi", is there a way of separating the 9235 or 14755 and put it in its own cell (K1:K90) the numbers will change daily.

Thanks
Ian
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
As long as all the records follow one of those two structures, this formula should work:
Excel Formula:
=TEXTBEFORE(TEXTAFTER(F1," ",3),"mi",1)
 
Upvote 1
Solution
Hi Joe4,thats works a treat, don't suppose you could explain the logic? :)
 
Upvote 0
Although if it's always the last thing in the phrase, this should also work:
=--TEXTBEFORE(TEXTAFTER(A2," ",-1),"mi")

I added the -- before it to coerce it to an actual number, you could do this with Joe4's formula too.
 
Upvote 0
Would the formula be able to give me depending on the cell containing either "service due in 9235mi" or "service overdue by 14755mi "Service 1234" or "Overdue 1234" as a result or is that a whole new formula?

Thanks
 
Upvote 0
If the strings are only ever those two options:
Book1
FG
1service due in 9235miService 9235
2service overdue by 14755miOverdue 14755
Sheet1
Cell Formulas
RangeFormula
G1:G2G1=IF(ISNUMBER(SEARCH("overdue",F1)),"Overdue ","Service ")&TEXTAFTER(TEXTBEFORE(F1,"mi")," ",3)
 
Upvote 0
Thanks dreid, not sure if its something I've done but the result for G1 comes back as Service in 9235?
 
Upvote 0
Thanks dreid, not sure if its something I've done but the result for G1 comes back as Service in 9235?
Did you copy the formula or retype it? Can you post exactly what formula you have?
 
Upvote 0

Forum statistics

Threads
1,215,331
Messages
6,124,311
Members
449,152
Latest member
PressEscape

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