Extract word from cell & paste in blank cell

honkin

Active Member
Joined
Mar 20, 2012
Messages
385
Office Version
  1. 2016
Platform
  1. MacOS
Is it possible to copy a word from multiple cells to a new location, but only if that location is blank?

Let me explain; Column C in the sheet is labelled Competition. If the selection is a football match, then the league is listed here, ie Norwegian 1st Division. If the selection is a horse race, then this cell is blank.

Column B is labelled Description and it has all of the information on the selections; Time, Date and so on.

My aim is to fill in the blanks in Column C with the name of the race course, which is located in Column B - 19:15 Windsor 5th Jul. The date and time will be variable as will the name, but I want to copy whatever the word is to the blank cell in Column C.

Examples
19:15 Windsor 5th Jul - the required word is Windsor
17:15 Pontefract 6th Jul - the required word is Pontefract

So you can see that the name of the course is always immediately after the time and finishes before the date. The ones from Australia are slightly different

03:01 EFrm (AUS) 7th Jul - the required info is EFrm (Aus)
03:29 Graf (AUS) 7th Jul - the required info is Graf (Aus)

So again you can see that the required information is always straight after the time and finishes before the date

Is what I am asking possible at all?

BFBM Results File.xlsb
BC
4DescriptionCompetition
513:00 Ayr 5th Jul\7f Nov Stks\Bastogne
617:00 Stjordals-Blink v Grorud IL\Over/Under 1.5 Goals\Under 1.5 GoalsNorwegian 1st Division
717:00 Asane v Jerv\Over/Under 1.5 Goals\Under 1.5 GoalsNorwegian 1st Division
817:00 Asane v Jerv\Over/Under 1.5 Goals\Under 1.5 GoalsNorwegian 1st Division
917:00 Sogndal v Strommen\Match Odds\StrommenNorwegian 1st Division
1019:15 Windsor 5th Jul\5f Hcap\Clarendon House
1119:15 Windsor 5th Jul\5f Hcap\Clarendon House
1220:15 Grotta v Vikingur Olafsvik\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic 1 Deild
1320:15 Vikingur Reykjavik v IA Akranes\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic Urvalsdeild
1420:15 Vikingur Reykjavik v IA Akranes\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic Urvalsdeild
1520:15 Vikingur Reykjavik v IA Akranes\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic Urvalsdeild
1620:15 Vikingur Reykjavik v IA Akranes\Over/Under 0.5 Goals\Under 0.5 GoalsIcelandic Urvalsdeild
1717:15 Pontefract 6th Jul\5f Hcap\Ava Go Joe
1819:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
1919:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\The DrawUruguayan Primera Division
2019:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2119:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2219:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2319:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2419:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\The DrawUruguayan Primera Division
2519:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Liverpool MontevideoUruguayan Primera Division
2619:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2719:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\The DrawUruguayan Primera Division
2819:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2923:00 Cruzeiro MG v Coritiba\Over/Under 2.5 Goals\Over 2.5 GoalsBrazilian Serie B
3023:00 Cruzeiro MG v Coritiba\Both teams to Score?\YesBrazilian Serie B
3123:30 Santos v Athletico-PR\Over/Under 2.5 Goals\Over 2.5 GoalsBrazilian Serie A
3223:30 Santos v Athletico-PR\Both teams to Score?\YesBrazilian Serie A
3323:30 Santos v Athletico-PR\Match Odds\Athletico-PRBrazilian Serie A
3403:01 EFrm (AUS) 7th Jul\R1 1800m Mdn\8. Victoria Park
3503:01 EFrm (AUS) 7th Jul\R1 1800m Mdn\8. Victoria Park
3603:29 Graf (AUS) 7th Jul\R1 1600m CL2\2. Divine Eleven
3703:29 Graf (AUS) 7th Jul\R1 1600m CL2\9. Lord Avatar
3803:29 Graf (AUS) 7th Jul\R1 1600m CL2\2. Divine Eleven
3903:36 EFrm (AUS) 7th Jul\R2 1400m 2yo\5. Millward
4003:36 EFrm (AUS) 7th Jul\R2 1400m 2yo\7. Mishani Diva
BM16
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A5:O1048576Cellcontains a blank value textNO


cheers
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Assuming those column C values are not formula results, try this with a copy of your workbook

VBA Code:
Sub GetLocation()
  With Range("C5:C" & Range("B" & Rows.Count).End(xlUp).Row)
    .Value = Evaluate(Replace(Replace("if(#="""",trim(replace(left(@,find(""\"",@)-8),1,5,"""")),#)", "#", .Address), "@", .Offset(, -1).Address))
  End With
End Sub

Here is my sheet after running the code

honkin.xlsm
BC
4DescriptionCompetition
513:00 Ayr 5th Jul\7f Nov Stks\BastogneAyr
617:00 Stjordals-Blink v Grorud IL\Over/Under 1.5 Goals\Under 1.5 GoalsNorwegian 1st Division
717:00 Asane v Jerv\Over/Under 1.5 Goals\Under 1.5 GoalsNorwegian 1st Division
817:00 Asane v Jerv\Over/Under 1.5 Goals\Under 1.5 GoalsNorwegian 1st Division
917:00 Sogndal v Strommen\Match Odds\StrommenNorwegian 1st Division
1019:15 Windsor 5th Jul\5f Hcap\Clarendon HouseWindsor
1119:15 Windsor 5th Jul\5f Hcap\Clarendon HouseWindsor
1220:15 Grotta v Vikingur Olafsvik\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic 1 Deild
1320:15 Vikingur Reykjavik v IA Akranes\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic Urvalsdeild
1420:15 Vikingur Reykjavik v IA Akranes\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic Urvalsdeild
1520:15 Vikingur Reykjavik v IA Akranes\Over/Under 1.5 Goals\Under 1.5 GoalsIcelandic Urvalsdeild
1620:15 Vikingur Reykjavik v IA Akranes\Over/Under 0.5 Goals\Under 0.5 GoalsIcelandic Urvalsdeild
1717:15 Pontefract 6th Jul\5f Hcap\Ava Go JoePontefract
1819:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
1919:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\The DrawUruguayan Primera Division
2019:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2119:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2219:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2319:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2419:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\The DrawUruguayan Primera Division
2519:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Liverpool MontevideoUruguayan Primera Division
2619:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2719:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\The DrawUruguayan Primera Division
2819:00 Liverpool Montevideo v Wanderers (Uru)\Match Odds\Wanderers (Uru)Uruguayan Primera Division
2923:00 Cruzeiro MG v Coritiba\Over/Under 2.5 Goals\Over 2.5 GoalsBrazilian Serie B
3023:00 Cruzeiro MG v Coritiba\Both teams to Score?\YesBrazilian Serie B
3123:30 Santos v Athletico-PR\Over/Under 2.5 Goals\Over 2.5 GoalsBrazilian Serie A
3223:30 Santos v Athletico-PR\Both teams to Score?\YesBrazilian Serie A
3323:30 Santos v Athletico-PR\Match Odds\Athletico-PRBrazilian Serie A
3403:01 EFrm (AUS) 7th Jul\R1 1800m Mdn\8. Victoria ParkEFrm (AUS)
3503:01 EFrm (AUS) 7th Jul\R1 1800m Mdn\8. Victoria ParkEFrm (AUS)
3603:29 Graf (AUS) 7th Jul\R1 1600m CL2\2. Divine ElevenGraf (AUS)
3703:29 Graf (AUS) 7th Jul\R1 1600m CL2\9. Lord AvatarGraf (AUS)
3803:29 Graf (AUS) 7th Jul\R1 1600m CL2\2. Divine ElevenGraf (AUS)
3903:36 EFrm (AUS) 7th Jul\R2 1400m 2yo\5. MillwardEFrm (AUS)
4003:36 EFrm (AUS) 7th Jul\R2 1400m 2yo\7. Mishani DivaEFrm (AUS)
Sheet3
 
Upvote 0
Hi Peter

Thanks so much for your reply.

It is almost spot on, but what happens when the date is double digit is that the first digit of the data appears after the course name, just as below

14:15 Perth 11th Jul\2m Nov Hrd\Homme Dun Soir - Perth 1
17:25 Sligo 11th Jul\2m2f INHF\Aslukwoodhavit - Sligo 1
13:15 Newton Abbot 12th Jul\2m2f Nov Hrd\Small Bad Bob - Newton Abbot 1
13:00 Market Rasen 17th Jul\2m2f Nov Hrd\Dal Horrisgle - Market Rasen 1

On the dates that are single digit, no issues. I imagine if the date was 24, then it would be using a 2 instead of a 1

So there is just something odd somewhere in the value line

cheers
 
Upvote 0
Sorry, I thought that I had allowed for that but must have mis-counted. Try making this change.
Rich (BB code):
.Value = Evaluate(Replace(Replace("if(#="""",trim(replace(left(@,find(""\"",@)-9),1,5,"""")),#)", "#", .Address), "@", .Offset(, -1).Address))
 
Upvote 0
Solution
Sorry, I thought that I had allowed for that but must have mis-counted. Try making this change.
Rich (BB code):
.Value = Evaluate(Replace(Replace("if(#="""",trim(replace(left(@,find(""\"",@)-9),1,5,"""")),#)", "#", .Address), "@", .Offset(, -1).Address))
Perfect mate and thanks so much. Just save a load of time highlighting, copying and pasting those course name

Take care
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
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