Extract Data String

kipper19

Board Regular
Joined
Apr 12, 2014
Messages
92
Office Version
  1. 365
Platform
  1. Windows
Hi All.
Is it possible to extract the data from a string like these examples below, the data to be extracted is always after a number ie, 1 to 9 and always before the $ sign

11-Mar-23 2100m GOOD 4 R8 LR BUNBURY CUP $2, so in this example the data extracted would be LR BUNBURY CUP

29-Jul-23 1600m HEAVY 9 R7 RTG 66+ $43, this one would be RTG 66+

14-Jun-23 1650m SOFT 6 R1 2YO & 3YO 0MWLY $943 (of $32, this one would be 2YO & 3YO 0MWLY
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try this

Book1
AB
111-Mar-23 2100m GOOD 4 R8 LR BUNBURY CUP $2, so in this example the data extracted would be LR BUNBURY CUPLR BUNBURY CUP
229-Jul-23 1600m HEAVY 9 R7 RTG 66+ $43, this one would be RTG 66+RTG 66+
314-Jun-23 1650m SOFT 6 R1 2YO & 3YO 0MWLY $943 (of $32, this one would be 2YO & 3YO 0MWLY2YO & 3YO 0MWLY
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=TRIM(LEFT(SUBSTITUTE(REPLACE(A1,1,AGGREGATE(14,6,SEARCH("R"&{1,2,3,4,5,6,7,8,9}&" ",A1),1)+2,""),"$",REPT(" ",500)),500))
 
Upvote 0
Solution
Where B5 = 11-Mar-23 2100m GOOD 4 R8 LR BUNBURY CUP $2

MID(B5,FIND("R",B5,20)+3,(LEN(MID(B5,FIND("R",B5,20)+3,FIND("$",B5,15)))-(LEN(B5)-FIND("$",B5,15))-1))
 
Upvote 0
Try this

Book1
AB
111-Mar-23 2100m GOOD 4 R8 LR BUNBURY CUP $2, so in this example the data extracted would be LR BUNBURY CUPLR BUNBURY CUP
229-Jul-23 1600m HEAVY 9 R7 RTG 66+ $43, this one would be RTG 66+RTG 66+
314-Jun-23 1650m SOFT 6 R1 2YO & 3YO 0MWLY $943 (of $32, this one would be 2YO & 3YO 0MWLY2YO & 3YO 0MWLY
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=TRIM(LEFT(SUBSTITUTE(REPLACE(A1,1,AGGREGATE(14,6,SEARCH("R"&{1,2,3,4,5,6,7,8,9}&" ",A1),1)+2,""),"$",REPT(" ",500)),500))
Thank You Phuoc, works well
 
Last edited by a moderator:
Upvote 0
Where B5 = 11-Mar-23 2100m GOOD 4 R8 LR BUNBURY CUP $2

MID(B5,FIND("R",B5,20)+3,(LEN(MID(B5,FIND("R",B5,20)+3,FIND("$",B5,15)))-(LEN(B5)-FIND("$",B5,15))-1))
BrerRabbit - Your solution works as well, thank you
 
Upvote 0
What about just this?

23 11 25.xlsm
AB
111-Mar-23 2100m GOOD 4 R8 LR BUNBURY CUP $2LR BUNBURY CUP
229-Jul-23 1600m HEAVY 9 R7 RTG 66+ $43RTG 66+
314-Jun-23 1650m SOFT 6 R1 2YO & 3YO 0MWLY $9432YO & 3YO 0MWLY
Extract
Cell Formulas
RangeFormula
B1:B3B1=TEXTAFTER(TEXTBEFORE(A1," $")," R"&SEQUENCE(9)&" ")
 
Upvote 0
Actually, based on your sample data, this even shorter one may be sufficient?

23 11 25.xlsm
AB
111-Mar-23 2100m GOOD 4 R8 LR BUNBURY CUP $2LR BUNBURY CUP
229-Jul-23 1600m HEAVY 9 R7 RTG 66+ $43RTG 66+
314-Jun-23 1650m SOFT 6 R1 2YO & 3YO 0MWLY $9432YO & 3YO 0MWLY
Extract (2)
Cell Formulas
RangeFormula
B1:B3B1=TEXTAFTER(TEXTBEFORE(A1," $")," ",5)
 
Upvote 0

Forum statistics

Threads
1,215,079
Messages
6,123,005
Members
449,092
Latest member
masterms

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