Hi,
I have a text string in Cell A1 that is populated by a program representing the Country, Course, Time and Distance etc of horse races and I want to extract the Course ie; Ling, Tampa, Redc & Distance elements ie; 5f, 1m, 2m4f, 2400m, 1780m etc into a variable for use in a Lookup
The string is of variable format and length and non UK races have a Country code in brackets.
There will only ever be 1 string (race) in Cell A1 at any one time, The external program will change Cell A1 when I ask it manually.
Here are some string examples that will appear in Cell A1:
Ling 11th Apr - 13:40 1m Hcap
MrktR 11th Apr - 14:00 2m Nov Hrd
MrktR 11th Apr - 14:30 2m4f Mdn Hrd
Ling 11th Apr - 16:50 1m4f Nov Stks
Dund 11th Apr - 20:30 1m2f Hcap
ChelmC 12th Apr - 17:45 5f Nov Stks
Long (FRA) 11th Apr - 11:55 1000m 2yo Claim
MontDe (FRA) 11th Apr - 16:10 2400m 4yo+ Hcap
Long (FRA) 11th Apr - 13:05 1600m 3yo Mdn
Redc (AUS) 11th Apr - 08:27 R1 1780m Pace M
Asct (AUS) 11th Apr - 09:10 R6 1600m CL5
Ipsw (AUS) 11th Apr - 07:38 R10 1350m Hcap
Geel (AUS) 11th Apr - 13:50 R11 2100m Pace M
Tampa (US) 11th Apr - 18:10 R2 7f Mdn Claim
Keenl (US) 11th Apr - 18:05 R1 1m1f Claim
Tampa (US) 11th Apr - 18:45 R3 6f Mdn Claim
Valpa (CHL) 11th Apr - 22:39 R10 1200m Hcap
So the extracted variable would look like this:
Ling1m
Ling1m4f
MontDe2400m
Keenl1m1f
etc
Can anyone write a VBA code to extract the string for me
I have a text string in Cell A1 that is populated by a program representing the Country, Course, Time and Distance etc of horse races and I want to extract the Course ie; Ling, Tampa, Redc & Distance elements ie; 5f, 1m, 2m4f, 2400m, 1780m etc into a variable for use in a Lookup
The string is of variable format and length and non UK races have a Country code in brackets.
There will only ever be 1 string (race) in Cell A1 at any one time, The external program will change Cell A1 when I ask it manually.
Here are some string examples that will appear in Cell A1:
Ling 11th Apr - 13:40 1m Hcap
MrktR 11th Apr - 14:00 2m Nov Hrd
MrktR 11th Apr - 14:30 2m4f Mdn Hrd
Ling 11th Apr - 16:50 1m4f Nov Stks
Dund 11th Apr - 20:30 1m2f Hcap
ChelmC 12th Apr - 17:45 5f Nov Stks
Long (FRA) 11th Apr - 11:55 1000m 2yo Claim
MontDe (FRA) 11th Apr - 16:10 2400m 4yo+ Hcap
Long (FRA) 11th Apr - 13:05 1600m 3yo Mdn
Redc (AUS) 11th Apr - 08:27 R1 1780m Pace M
Asct (AUS) 11th Apr - 09:10 R6 1600m CL5
Ipsw (AUS) 11th Apr - 07:38 R10 1350m Hcap
Geel (AUS) 11th Apr - 13:50 R11 2100m Pace M
Tampa (US) 11th Apr - 18:10 R2 7f Mdn Claim
Keenl (US) 11th Apr - 18:05 R1 1m1f Claim
Tampa (US) 11th Apr - 18:45 R3 6f Mdn Claim
Valpa (CHL) 11th Apr - 22:39 R10 1200m Hcap
So the extracted variable would look like this:
Ling1m
Ling1m4f
MontDe2400m
Keenl1m1f
etc
Can anyone write a VBA code to extract the string for me
Last edited: