Column to that will match names with previous instances --> test those instances against certain conditions

Michaelson

New Member
Joined
Aug 14, 2011
Messages
14
Hello all,

Here's a pic with the data I think is relevant. This is Excel 2007 on XP btw.

byeandmonday.jpg


I need to generate four more columns:

Col AQ ('Home Team Returning From Bye')
Col AR ('Away Team Returning From Bye')
Col AS ('Home Team Backing up from Monday')
Col AT ('Away Team Backing up from Monday')

Column AQ needs to return results in instances where the Home Team's previous game was two rounds earlier. So Melbourne in round 12 above were a team coming off the bye: their previous game was in round 10.

Note: it doesn't matter whether the previous game was played at home or away. This is the same for every column.

Column AR is the same as AQ but testing the Away Teams.

Columns AS and AT have to list results where the relevant team's previously played game was on a Monday. In Round 9 pictured above Manly and Canberra played on Monday night. So for their round 10 games I need to get a positive hit for these teams in the 'Backing up from Monday' columns that apply (these teams both played away games in Round 10, so the positive results should appear in Col AT).

For these columns, just to complicate matters, I don't want it to return matches for teams whose last game was a Monday, but came before a bye. So Manly in Round 12 last played on a Monday, but they had the bye in between so I don't want to pick that up as a hit.

Thankyou in advance for any help! I've learned a lot working on this spreadsheet and have been able to do most things I've needed to do with IFs and COUNTIFS and the like, but for this I don't really know where to start!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
One reason you may have not had help earlier is the way you have provided your sample data. It cannot be copied from that image so if somebody wants to test a formula, they would have to type a lot of that data from the screen to their workbook. You will get much better/faster help if you post copyable sample data directly into your post. My signature block has suggestions for that.

I have assumed that the values in column C are text. If they are dates, formatted to show just the day, my formulas for columns AS and AT will need to be modified.

Clearly my results for rounds 9 and 10 will be problematic since I don't have all the round 9 data.

All formula copied down (and up).

Excel Workbook
ABCEIAQARASAT
6898/05/11SundaySt George-IllawarraNorth QueenslandTRUETRUEFALSEFALSE
6999/05/11MondayManlyCanberraTRUETRUEFALSEFALSE
701013/05/11FridayCanterburySt George-IllawarraTRUEFALSEFALSEFALSE
711013/05/11FridayPenrithBrisbaneTRUETRUEFALSEFALSE
721014/05/11SaturdayMelbourneCanberraTRUEFALSEFALSETRUE
731014/05/11SaturdayNorth QueenslandParramattaFALSETRUEFALSEFALSE
741014/05/11SaturdaySouth SydneyWests TigersTRUETRUEFALSEFALSE
751015/05/11SundayNewcastleNZ WarriorsTRUETRUEFALSEFALSE
761015/05/11SundayCronullaSydney RoostersTRUETRUEFALSEFALSE
771016/05/11MondayGold CoastManlyTRUEFALSEFALSETRUE
781120/05/11FridayCanberraCanterburyFALSEFALSEFALSEFALSE
791121/05/11SaturdayWests TigersPenrithFALSEFALSEFALSEFALSE
801122/05/11SundayNZ WarriorsSouth SydneyFALSEFALSEFALSEFALSE
811122/05/11SundaySydney RoostersNewcastleFALSEFALSEFALSEFALSE
821123/05/11MondayParramattaCronullaFALSEFALSEFALSEFALSE
831227/05/11FridayManlyBrisbaneTRUETRUEFALSEFALSE
841227/05/11FridayCanterburyGold CoastFALSETRUEFALSEFALSE
851228/05/11SaturdayNewcastleParramattaFALSEFALSEFALSETRUE
861228/05/11SaturdayNorth QueenslandSydney RoostersTRUEFALSEFALSEFALSE
871229/05/11SundayMelbourneCronullaTRUEFALSEFALSETRUE
881229/05/11SundaySt George-IllawarraWests TigersTRUEFALSEFALSEFALSE
Team Info
 
Upvote 0
On second thoughts, this is simpler and I think still does the trick.

Excel Workbook
ABCEIAPAQARASAT
6898/05/11SundaySt George-IllawarraNorth Queensland9: St George-Illawarra: North Queensland: SundayTRUETRUEFALSEFALSE
6999/05/11MondayManlyCanberra9: Manly: Canberra: MondayTRUETRUEFALSEFALSE
701013/05/11FridayCanterburySt George-Illawarra10: Canterbury: St George-Illawarra: FridayTRUEFALSEFALSEFALSE
711013/05/11FridayPenrithBrisbane10: Penrith: Brisbane: FridayTRUETRUEFALSEFALSE
721014/05/11SaturdayMelbourneCanberra10: Melbourne: Canberra: SaturdayTRUEFALSEFALSETRUE
731014/05/11SaturdayNorth QueenslandParramatta10: North Queensland: Parramatta: SaturdayFALSETRUEFALSEFALSE
741014/05/11SaturdaySouth SydneyWests Tigers10: South Sydney: Wests Tigers: SaturdayTRUETRUEFALSEFALSE
751015/05/11SundayNewcastleNZ Warriors10: Newcastle: NZ Warriors: SundayTRUETRUEFALSEFALSE
761015/05/11SundayCronullaSydney Roosters10: Cronulla: Sydney Roosters: SundayTRUETRUEFALSEFALSE
771016/05/11MondayGold CoastManly10: Gold Coast: Manly: MondayTRUEFALSEFALSETRUE
781120/05/11FridayCanberraCanterbury11: Canberra: Canterbury: FridayFALSEFALSEFALSEFALSE
791121/05/11SaturdayWests TigersPenrith11: Wests Tigers: Penrith: SaturdayFALSEFALSEFALSEFALSE
801122/05/11SundayNZ WarriorsSouth Sydney11: NZ Warriors: South Sydney: SundayFALSEFALSEFALSEFALSE
811122/05/11SundaySydney RoostersNewcastle11: Sydney Roosters: Newcastle: SundayFALSEFALSEFALSEFALSE
821123/05/11MondayParramattaCronulla11: Parramatta: Cronulla: MondayFALSEFALSEFALSEFALSE
831227/05/11FridayManlyBrisbane12: Manly: Brisbane: FridayTRUETRUEFALSEFALSE
841227/05/11FridayCanterburyGold Coast12: Canterbury: Gold Coast: FridayFALSETRUEFALSEFALSE
851228/05/11SaturdayNewcastleParramatta12: Newcastle: Parramatta: SaturdayFALSEFALSEFALSETRUE
861228/05/11SaturdayNorth QueenslandSydney Roosters12: North Queensland: Sydney Roosters: SaturdayTRUEFALSEFALSEFALSE
871229/05/11SundayMelbourneCronulla12: Melbourne: Cronulla: SundayTRUEFALSEFALSETRUE
881229/05/11SundaySt George-IllawarraWests Tigers12: St George-Illawarra: Wests Tigers: SundayTRUEFALSEFALSEFALSE
Team Info
 
Upvote 0
Thankyou so much for this!

If I had realised how important it was to post in an easy to copy/paste format I would have. I'm very sorry, and grateful, that you took the time to type out all that data! I will certainly make sure to post using Excel Jeanie in the future.

Can I ask exactly how those formulas work? The criteria parts in particular, and having them equal zero and one respectively?

Thanks again!
 
Upvote 0
.. grateful, that you took the time to type out all that data!
I wasn't that keen. ;)
Luckily I had access to a draw in Excel so a Copy/Paste or two and I pretty much had it. :)


Can I ask exactly how those formulas work? The criteria parts in particular, and having them equal zero and one respectively?
You have all the critical info for each row in your concatenated values in col AP.

Lets take the formula in AQ88 (home team returning from a bye?):
=COUNTIF(AP$2:AP87,A88-1&"*"&E88&"*")=0

A88 (=12) is the round relating to that row.
E88 is the home team (St George-Illawarra) in that row.

So the formula becomes:
=COUNTIF(AP$2:AP87,12-1&"*"&"St George-Illawarra"&"*")=0
=COUNTIF(AP$2:AP87,"11*St George-Illawarra*")=0

The green part counts the rows above row 88 in column AP that ..
- start with 11
- followed by any text (* is a wildcard for any number of characters)
- followed by "St George Illawarra"
- followed by any text

If St George had played in round 11, the result of this count would be 1. As it is, because StG did not play in round 11, this count is 0.
So putting this count = 0 returns TRUE because StG did not play in round 11.

Similar for the away team returning from a bye.
So now to backing up from Monday the previous round. Take the formula in AT87 (away team backing up from Monday?):

=COUNTIF(AP$2:AP86,A87-1&"*"&I87&"*"&"Monday")=1
=COUNTIF(AP$2:AP86,12-1&"*"&"Cronulla"&"*"&"Monday")=1
=COUNTIF(AP$2:AP86,"11*Cronulla*Monday")=1

Since the red pattern (start with 11 followed by anything followed by Cronulla followed by anything followed by Monday at the end) is found in cell AP82, the COUNTIF returns a 1 and therefore the formula returns TRUE since Cronulla played on Monday in the previous round.
 
Upvote 0
You are a true champion and I say that even though I now know you didn't type out a mass of data into a spreadsheet to help me out.

Really, thanks a bunch!
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,691
Members
452,938
Latest member
babeneker

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