Need help generating a complex formula

Michaelson

New Member
Joined
Aug 14, 2011
Messages
14
I am trying to put together a sports data spreadsheet. On the main data sheet I want to include two automatically generated columns to display the team's turnaround times between games.

backuptime.jpg


This is the layout of the relevant part of the sheet. So let's say we wanted to generate this data for the highlighted team Wests Tigers. It's a simple enough matter of subtracting the date of the previous game they played from the date of their most recent game. In this case a formula that in the end boils down to '=B32-B21'

But is this possible to generate automatically?

I plan to have two columns, one for 'Home Team Turnaround' and one for away teams. So what I need is a formula that takes the date from the 'Date' column, then finds the team in question's most recent game from either the 'Home Team' or 'Away Team' column, then extracts the corresponding date for that game so it can be detracted from the initial date.

Does that make sense?

I'm thinking the round number (column A) may come in handy for this but still don't really know where to start... Any help would be greatly appreciated!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You might consider first adding a "key" column to the right on each row that concatenates Round, Home Team and Away Team into a single string, eg:

Code:
Z2:
=$A2&":"&$E2&":"&$I2&":"
copied down

Then, if we assume Home Turnaround to be displayed in Col X

Code:
X2:
=IF($A2=1,"n/a",$B2-SUMIF($Z:$Z,$A2-1&"*:"&$E2&":*",$B:$B)
copied down

For Away side (Col Y) we simply adjust the references in the Col Z test accordingly:

Code:
Y2:
=IF($A2=1,"n/a",$B2-SUMIF($Z:$Z,$A2-1&"*:"&$I2&":*",$B:$B))
copied down

(you could also use a MATCH with wildcard if preferred)

The same results could be achieved without use of Col Z, however, IMO it's worth adding for sake of efficiency.
 
Upvote 0
Hi Michaelson,

I'm not sure if it is what you need, the following array formula take current value in "Home Team" column and look for more recent
dates to do the substraction.

As you can see in Result column (J), the values with blue background are the results for Team2 in column E.

B3-B2=1
B12-B7=5
B22-B15=7
Excel Workbook
ABCDEFGHIJ
1RdDateDayVenueHome TeamHome H/THome 2HHome ScoreAway TeamDates differences
211/03/2011Team1Team2No previous game
312/03/2011Team2Team31
413/03/2011Team3Team41
514/03/2011Team4Team51
615/03/2011Team5Team61
716/03/2011Team6Team21
817/03/2011Team7Team8No previous game
918/03/2011Team8Team91
1019/03/2011Team9Team101
1120/03/2011Team10Team41
1221/03/2011Team2Team55
1322/03/2011Team3Team69
1423/03/2011Team4Team73
1524/03/2011Team5Team23
1625/03/2011Team6Team93
1726/03/2011Team7Team103
1827/03/2011Team8Team19
1928/03/2011Team9Team43
2029/03/2011Team10Team33
2130/03/2011Team1Team43
2231/03/2011Team2Team57
2301/04/2011Team3Team63
2402/04/2011Team4Team73
2503/04/2011Team5Team83
...

Insert in J2 and copy down:
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}. Note: Do not try and enter these manually yourself
Hope this helps.

Regards
 
Last edited:
Upvote 0
Cesar, given Array context I would advise you replace the volatile INDIRECT approach with INDEX

edit: FWIW, given the dataset is sorted I think you could simplify that approach.
 
Last edited:
Upvote 0
Cesar, given Array context I would advise you replace the volatile INDIRECT approach with INDEX

edit: FWIW, given the dataset is sorted I think you could simplify that approach.
Thanks DonkeyOte,

I'll have present in my mind your kindly suggestion, replacing INDIRECT with INDEX the formula would be:
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter these manually yourself



Simplify the formula is a pending task for me
:biggrin:

Regards.

Many thanks again.
 
Upvote 0
Thankyou both for your responses. cg, your second suggestion seems to work, thanks! I don't really understand it though unfortunately, which means I can't work out what to change to generate the list for the Away team. Do you mind providing that formula as well?

Donkey, I tried your suggestion and as you can see got some funny results, like not working for rounds 2 and 3 at all, and getting some anomalous wrong results for the numbers it does generate.

arraym.jpg


Anyway, that's neither here nor there, just thought it may be of interest.

Having generated that Key column though, I wonder is there a way that I could generate a column that lists teams returning from the bye for those teams that didn't play in the round previous? That would be great if I could!

Thankyou both again!
 
Upvote 0
I don't really understand it though unfortunately, which means I can't work out what to change to generate the list for the Away team. Do you mind providing that formula as well?

Just replace every E with an I and vice versa obviously.

Duh!

Any help generating that "Coming off Bye" column would be greatly appreciated.
 
Upvote 0
Having generated that Key column though, I wonder is there a way that I could generate a column that lists teams returning from the bye for those teams that didn't play in the round previous?
You're welcome Michael.

Regarding the other question, please upload a sample excel file and show how should be the output you need for that
"Coming off Bye" column, and where should be to appera the result. Explain a little bit to anybody could
understand and help easier.

Regards.
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,510
Members
452,918
Latest member
Davion615

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