needlesmcgir All American 2427 Posts user info edit post |
So I run a Fantasy League (Yahoo) and this year we are going to have divisions. There are 12 teams with 3 divisions (4 teams in each division). I would like it so that teams play other teams in their division 2 times, and every other team 1 time.
I'm trying to figure out how I can come up with a way to output this schedule randomly in a table like in Excel. I'm thinking a macro would be the way to go but I'm not really sure how to do this. Anyone want to take a stab at this or point me in the right direction? Seems like it should be a pretty easy bit of code. Thanks in advance. 8/21/2009 9:57:53 AM |
Ernie All American 45943 Posts user info edit post |
Five seconds of googling and I found this: http://www.grogansports.com/fantsched.asp
If that doesn't work, there are about 189,000 other results you can look through. 8/21/2009 11:48:52 AM |
sd2nc All American 9963 Posts user info edit post |
If you don't like Google, you can try Yahoo or Bing. 8/21/2009 12:25:32 PM |
needlesmcgir All American 2427 Posts user info edit post |
Thanks for your help. Wasn't really looking for a set schedule, thought it would be cool to have a random schedule be output in excel or something so I can use it over the years without having the same static schedule. 8/21/2009 12:35:55 PM |
A Tanzarian drip drip boom 10995 Posts user info edit post |
What I did (though not completely automated):
Created two tables:
I numbered the teams so that the first digit is division number (1-3) and the second digit is team number (1-4).
The top table counts how many times the teams play each other and uses the formula COUNTIF($B20:$O20,"="&B$1)
The lower table is the schedule. I filled in the top row manually and filled the remaining cells with VLOOKUP($A21,B$20:$P20,16-B$19,FALSE). When you enter one game (e.g. 11 vs. 12) the formula fills in the cell for the other team (12 vs. 11).
Fill in the games from the top down. 8/21/2009 12:49:08 PM |
Ernie All American 45943 Posts user info edit post |
Quote : | "Thanks for your help. Wasn't really looking for a set schedule, thought it would be cool to have a random schedule be output in excel or something so I can use it over the years without having the same static schedule." |
Jesus Christ
Assign a random number to each team
There
You have a billion schedule possibilities8/21/2009 1:11:26 PM |
needlesmcgir All American 2427 Posts user info edit post |
Thanks for this example, this could work out pretty well. 8/21/2009 1:20:38 PM |
smoothcrim Universal Magnetic! 18966 Posts user info edit post |
12 lines of java/python/c++/c max. use array lists or vectors as the collection for the teams to avoid complicated logic from using arrays and randomize 8/21/2009 2:41:31 PM |
needlesmcgir All American 2427 Posts user info edit post |
Thanks for all your help. Ernie, why you gotta be a douche bag? 8/21/2009 10:27:51 PM |
Spontaneous All American 27372 Posts user info edit post |
Ernie doesn't like people. 8/22/2009 8:17:52 AM |
Drovkin All American 8438 Posts user info edit post |
8/22/2009 3:57:38 PM |
Ernie All American 45943 Posts user info edit post |
Hey
Make a picture like that using an actual photo of me
Label it douchebag
And have an arrow pointing at my brain
The caption can read
"Provided the best answer in this thread, but wasn't very polite about it." 8/22/2009 7:54:26 PM |