Closed Thread
Results 1 to 28 of 28

Generate all possible combinations - 8 games, 2 teams, 3 outcomes

  1. #1
    Registered User
    Join Date
    02-05-2015
    Location
    Karratha, Australia
    MS-Off Ver
    2010
    Posts
    15

    Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hi all,

    I need to create a spreadsheet which will generate all possible combinations of 8 games of soccer consisting of two teams who can each win or come a draw (3 outcomes per game).

    Note: For every game, there will be three outcomes however there are 8 different games therefore those three outcomes will need to be calculated again against the other 24 outcomes (3*8) to give me ALL possible outcomes without repeating (i.e Team A win, Team C Draw & Team C Draw & Team A win is the same outcome).

    Not the best explanation sorry! I have attached an example which I have created manually which I hope helps however please note I require 8 games containing 16 different teams (2 per game). I've browsed through a few threads where people have mentioned MACROS & VBA which I've never used before.. I do need to be able to change the team names on a weekly basis.

    Apparently there are 6561 possible outcomes.. I need details on exactly what they would be.

    Thanks in advance,
    Aravia
    Attached Files Attached Files
    Last edited by Aravia; 09-27-2015 at 04:37 AM.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hi Aravia,

    Very interesting question. Your math is probably correct, because I came up with 6561 results. I apologize for using the names of Baseball teams in my sample data. Thanks to pgc01 in post #2 of the following thread for the original recursive Combinations code: http://www.mrexcel.com/forum/excel-q...mutations.html

    How the software works:
    a. Generate a list of 24 possible data outcomes (8 teams which can either Win, Lose, or Draw).
    b. Take combinations of the 24 items 8 at one time.
    c. If any team is duplicated in the result (occurs more than once), do not include that result in the final data. According to a table of combinations http://www.rpbridge.net/7z78.htm 24 items taken 8 at one time generates 735,471 combinations.
    d. Each result that contains 8 different teams is output to the SpreadSheet.

    See the attached file which contains the following code. I made the code specific to your problem, rather than generalized, in order to make it a little easier to understand the code.
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    There's a workbook at https://app.box.com/s/f21e5iithnbg13alcqbt with formula- and vba-based methods to do that.

    Row\Col
    B
    C
    D
    E
    F
    G
    H
    I
    4
    HW HW HW HW HW HW HW HW
    5
    D D D D D D D D
    6
    AW AW AW AW AW AW AW AW
    7
    8
    HW HW HW HW HW HW HW HW
    9
    HW HW HW HW HW HW HW D
    10
    HW HW HW HW HW HW HW AW
    11
    HW HW HW HW HW HW D HW
    12
    HW HW HW HW HW HW D D
    13
    HW HW HW HW HW HW D AW
    14
    HW HW HW HW HW HW AW HW
    15
    HW HW HW HW HW HW AW D
    16
    HW HW HW HW HW HW AW AW
    17
    HW HW HW HW HW D HW HW
    18
    HW HW HW HW HW D HW D
    19
    HW HW HW HW HW D HW AW
    20
    HW HW HW HW HW D D HW
    21
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    02-05-2015
    Location
    Karratha, Australia
    MS-Off Ver
    2010
    Posts
    15

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Lewis, your spreadsheet is amazing - THANK YOU!

    A few questions - how can I reduce it down to 6 games? I've had a look at the macro but can't quite figure out where I would amend the formula..

    Also, is there anyway I can get it to display the team in column C as a Win rather than their opponent as a loss? If this makes the macro more complicated than it is don't worry about it, just me being picky!

    Thanks for your reply too shg, I'll have a look at that workbook too

    Cheers,
    Aravia

  5. #5
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hi Aravia

    Someone else asked for something like your question for 5 games
    I solved that in a much simpler way (less professional looking), easier to read for a newby

    Besides it has the chance to select some games as "must be winer" so, no draw result is possible.
    just put a mark( put a leter or a number) in the correspondent cell.

    Start your spreadsheet like this image:

    Captura.PNG

    and run this code

    Please Login or Register  to view this content.
    hope it helps you
    Last edited by vichopalacios; 09-28-2015 at 12:13 PM.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    a. how can I reduce it down to 6 games?
    b. Can I get it to display the team in column C as a Win rather than their opponent as a loss?
    See the attached file, which has options for:
    a. The number of games to include (2 thru 12 inclusive)
    b. Replacing 'Lose' with 'Win' for the winning team.
    c. Including the names of both teams for a 'Draw'.

    On my old Vista 32 bit computer running times were:
    06 teams = 5 seconds
    07 teams = 17 seconds
    08 teams = 65 seconds
    09 teams = 5 minutes
    10 teams = 25 minutes
    11 teams = 2 hours (estimate)
    12 teams = 10 hours (estimate)

    Lewis

  7. #7
    Registered User
    Join Date
    12-08-2015
    Location
    NYC
    MS-Off Ver
    None
    Posts
    2

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hi Vichopalacios,

    Awesome excel code. How would I make it for 12 games 24 teams?

    Thanks again

  8. #8
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hi @dymaster

    check the attached file, it is ready for 10 games, but the table is prepared for 12 games and 24 teams
    just increase 2 more "for next's loops" and complete the inner "g loop".

    Take care about the time, the code will run for more than 30 seconds for the 10 games, and it will look like frozen...
    just be patient and wait for the results.
    If you go for 12 games, time will be much, much longer !!
    Play a bit with it, and comment us how are you going on.

    cheers
    Attached Files Attached Files
    Barriers are there for those who don't want to dream

  9. #9
    Registered User
    Join Date
    04-15-2016
    Location
    New York
    MS-Off Ver
    2013
    Posts
    1

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    @ Lewis

    Incredible sheet. I am wondering if you could help me figure out how to run the code WITHOUT the potential of a draw. I can't seem to figure it out...thanks so much!

    Mike

  10. #10
    Registered User
    Join Date
    05-16-2016
    Location
    kaduna
    MS-Off Ver
    2007
    Posts
    2

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    hello pals..... please i would love some one to help me please

    i need to create a spreed sheet of 10 combinations with 6 outcomes..... using outcome 0-5 as the possible outcomes for the 10 combination, the total number of combinations are 210 but would love to see the spreed ****...

    i need your help pals

    the combinations would be like

    1,2,3,4,5,6,6,1,2,0
    2,2,3,6,7,7,7,8,9,9

    pls help me

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    avido welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    avido welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

  13. #13
    Registered User
    Join Date
    05-31-2017
    Location
    USA
    MS-Off Ver
    15.24
    Posts
    1

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hey everyone, this is my first go around on the forum and had a couple of questions... In regards to the 12 games with 24 teams, is it possible to make it 15 games with 30 teams and only 2 outcomes? I'm playing around with all the possibilities for a standard day of Major League Baseball games if all teams are slated to play, and didn't know if it is possible to do with what you have created.

    Thanks everyone!

  14. #14
    Registered User
    Join Date
    06-18-2017
    Location
    Kenya
    MS-Off Ver
    Windows
    Posts
    2
    Hey does your link still work kindly resend it to me via [email protected] please
    Last edited by FDibbins; 06-19-2017 at 01:41 AM.

  15. #15
    Registered User
    Join Date
    06-18-2017
    Location
    Kenya
    MS-Off Ver
    Windows
    Posts
    2
    Hey send me your version please

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Quote Originally Posted by 0727490993 View Post
    Hey does your link still work kindly resend it to me via [email protected] please
    I have removed your email addy, it is never a good idea to post personal info in a public web site

    Also, please read my posts above regarding posting on other member's threads

  17. #17
    Registered User
    Join Date
    09-07-2017
    Location
    Nairobi
    MS-Off Ver
    2013
    Posts
    6

    Post Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hi Experts
    I wish to generate all possible outcome for 13games, 2 teams, 3 outcomes.
    Anyone who can assist in modifying any of the excels within the thread.
    Any assistance is highly appreciated.

  18. #18
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Welcome to the board.

    That's 3^13 ~ 1.6 million possible outcomes. What would you do if you had them?

  19. #19
    Registered User
    Join Date
    09-07-2017
    Location
    Nairobi
    MS-Off Ver
    2013
    Posts
    6
    Quote Originally Posted by shg View Post
    Welcome to the board.

    That's 3^13 ~ 1.6 million possible outcomes. What would you do if you had them?
    Would wish tp fugure out all the combination and see how it plays out.....If in a position i wish the macro to dispay 1 gor home win....X for draw and 2 for an away win.....will really greatly appreciate if anyone can be able to give the macro...
    Thank you experts

  20. #20
    Registered User
    Join Date
    09-07-2017
    Location
    Nairobi
    MS-Off Ver
    2013
    Posts
    6

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Hi Experts
    I wish to generate all possible outcome for 13games, 2 teams, 3 outcomes.
    Anyone who can assist in giving a macro on excel that can generate the outcomes approx 1.6 million will be highly appreciated.
    Where possible, I wish a win for the home team to be dispalyed as 1, Draw to be X and an away Win to be displayed as 2 e.g first combination 12XX11X21221X etc
    Rgds.

  21. #21
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Please Login or Register  to view this content.
    A
    B
    C
    D
    E
    F
    G
    H
    I
    2
    1111111111111 1X11111111111 1211111111111 X111111111111 XX11111111111 X211111111111 2111111111111 2X11111111111 2211111111111
    3
    111111111111X 1X1111111111X 121111111111X X11111111111X XX1111111111X X21111111111X 211111111111X 2X1111111111X 221111111111X
    4
    1111111111112 1X11111111112 1211111111112 X111111111112 XX11111111112 X211111111112 2111111111112 2X11111111112 2211111111112
    5
    11111111111X1 1X111111111X1 12111111111X1 X1111111111X1 XX111111111X1 X2111111111X1 21111111111X1 2X111111111X1 22111111111X1
    6
    11111111111XX 1X111111111XX 12111111111XX X1111111111XX XX111111111XX X2111111111XX 21111111111XX 2X111111111XX 22111111111XX
    7
    11111111111X2 1X111111111X2 12111111111X2 X1111111111X2 XX111111111X2 X2111111111X2 21111111111X2 2X111111111X2 22111111111X2
    177146
    1122222222221 1X22222222221 1222222222221 X122222222221 XX22222222221 X222222222221 2122222222221 2X22222222221 2222222222221
    177147
    112222222222X 1X2222222222X 122222222222X X12222222222X XX2222222222X X22222222222X 212222222222X 2X2222222222X 222222222222X
    177148
    1122222222222 1X22222222222 1222222222222 X122222222222 XX22222222222 X222222222222 2122222222222 2X22222222222 2222222222222
    Last edited by shg; 09-07-2017 at 11:05 AM.

  22. #22
    Registered User
    Join Date
    09-07-2017
    Location
    Nairobi
    MS-Off Ver
    2013
    Posts
    6

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    @shg...forum guru
    It really solved my request to some extent. Thanks for your solution. Again thank you.
    Is it possible for each single outcome/combination of 13 games to be placed in 13 cells eg A1 to A13 and next one on B1 to B13 instead of being placed in a single cell?
    Last edited by Gacheru; 09-07-2017 at 11:51 AM.

  23. #23
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Copy one of those 9 columns to another sheet, select the new column > Data >Text to columns, Fixed width, ...

  24. #24
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,688

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Quote Originally Posted by Gacheru View Post
    Hi Experts
    I wish to generate all possible outcome for 13games, 2 teams, 3 outcomes.
    Anyone who can assist in modifying any of the excels within the thread.
    Any assistance is highly appreciated.
    Notwithstanding that your question is being answered, we prefer that you ask a new question in a new thread.

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  25. #25
    Registered User
    Join Date
    09-28-2017
    Location
    London, England
    MS-Off Ver
    8
    Posts
    1

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Could you do this same formula...but with just Win or Lose? I would appreciate it

  26. #26
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,351

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Welcome to the forum!

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  27. #27
    Registered User
    Join Date
    05-30-2018
    Location
    Sippy Downs, Australia
    MS-Off Ver
    14.3.6
    Posts
    1

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    Looking for a similar spreadsheet but the variants would be 4 games, 2 teams, 2 outcomes (either team to win 1-12 or 13+)

  28. #28
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: Generate all possible combinations - 8 games, 2 teams, 3 outcomes

    @nkingi

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to generate all possible outcomes from different number of matches
    By Ipinho100 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-07-2014, 08:06 AM
  2. Sports schedule - 8 games with varying teams
    By kristys5 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-30-2013, 12:53 AM
  3. Replies: 6
    Last Post: 06-04-2013, 03:16 PM
  4. [SOLVED] Generate all possible outcomes
    By AmpleFlame in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-06-2013, 07:46 PM
  5. [SOLVED] Trimming text from a sheet with teams and scores of games
    By mrvp in forum Excel General
    Replies: 3
    Last Post: 09-10-2012, 03:53 PM
  6. Generate Random Teams
    By rwhite713 in forum Excel General
    Replies: 3
    Last Post: 07-24-2010, 08:07 PM
  7. generate numbers given probability of outcomes
    By jerdjets in forum Excel General
    Replies: 5
    Last Post: 11-15-2007, 07:25 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1