+ Reply to Thread
Results 1 to 15 of 15

a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplicates

  1. #1
    Registered User
    Join Date
    03-08-2015
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    8

    a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplicates

    I have just started with VBA as I have been asked to supply teams of 4 or 3 depending on input.
    I would have a list of players , 21 total but we are never all available , as input and then press a key for the teams, if possible without duplicates until necessary again.

    Could you give some advice here.

    Thank you

    Mapia

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    03-08-2015
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    8

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hello Sixthsense,

    Thank you so much for your help.
    I have created a demo workbook where sheet 1 is the players with their Id, Sheet 2 is where the players would be entered and button create teams used. Sheet 3 illustrates what would be required the following week , when different players entered and still no 2 players together. Obviously this can't be avoided after a few weeks.

    Hope you can help,

    Thanks,
    Mapia
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Question:
    How do you breakdown a group of 21? 7 teams of 3 people? Or 3 teams of 4 people plus 3 teams of 3 people?
    How about 20? 5 teams of 4? Or 2 teams of 4 plus 4 teams of 3?
    How about 19? 4 teams of 4 plus 1 team of 3? or 1 team of 4 and 5 teams of 3?
    Etc.

    In other words, do you want to maximixe the number of 4 player teams first, then make 3 player teams? Or the other way around?

  5. #5
    Registered User
    Join Date
    03-08-2015
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    8

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi Djapigo,

    It should be your last comment, maximize 4 players teams then 3 player teams .

    cheers,
    Mapia

  6. #6
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    I'm not sure if i understand your meaning

  7. #7
    Registered User
    Join Date
    03-08-2015
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    8

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Sorry I made a mistake in week 2 so I have now adjusted the sheet to show no duplicates.

    Thanks,
    Mapia
    Attached Files Attached Files

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi mapia,

    As you've found this isn't a trivial problem. Find the attached where I solved it for a club that had a similar rule. This club played a weekly event match play where no two players were supposed to play against each other again throughout the season. This meant we needed to keep track of every prior match that was played. That was the first problem. Spellings their names the same way all season was also a problem, but not part of the workbook as I recall.

    The structure of this workbook is important for solving this problem. You are trying to do a sheet per week and I used a sheet called "AllResults". My AllResults sheet has the group number that two opponents played in (this two can be a 3 or 4 by clicking on the Resize Groups for threesomes or foursomes). So in Column A of the AllResults sheet is the number of the group people played together in. This structure allows me to help pick people who haven't played together (on the same team) before. This AllResults sheet structure which you can do is part of the secret for solving your problem.

    The reason this problem is very hard, is there might not be an answer. How do you find a group of 4 where none of the players have never played together if there is no answer? My answer to this was to build random teams and see if players fit the criteria (not having played together before). I'd do this 1000 times and if no answer was found, I could try another 1000 or simply let the random pairing stand. We called this solution by exhaustion.

    This is the first time I've had anyone who cared (I hope you are still reading) the trick in this answer....
    1. You pick 2 players at random (you could use 3 or 4 as well).
    2. You do an advanced filter of the all results using those player names. I do this on the WeekRound sheet in Column AA.
    3. Along comes the group numbers they have played in. If any of those group numbers match, I randomly pick other players and try again.

    The above 3 steps takes some head scratching to see why this works. I also use a Frequency function to see the same group number shows up.

    After the event I click on the "Post Round To Results" button that adds this week's matches to the Results tab giving that group a unique number to show they have all played together.

    I do all the above using VBA, and a 1000 tries takes a few seconds to perform.

    Find attached the workbook that was last used to perform this magic. The players sheet has an Event macro behind it to select the players who are going to play. I use a double click in Column A to add an "x" is they are playing this week.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  9. #9
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi,mapia:
    if my file can fulfill the task, pls consider adding my reputation.haha

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi mapia and semcode,

    Explaining the Advanced Filter with Team numbers is a little hard. See the example where I've done it by hand on the new week sheet. See if it makes more sense when all the steps are shown on a single sheet.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-08-2015
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    8

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi MarvinP and semcode,
    Thank you both very much for taking the time to help me solve this problem.
    Obviously Marv you have so much more experience, so impressed with your logic behind the duplicates problem.
    Your workbook ' random golf pairings ' is incredible and too much for my needs at the moment, but I will save it for the future. I will have to extract your code for players, weekround, allresults , understand the code ! and then try to get it to work. I have one question , what happens when they have all played with each other so then they have to start again , so duplicates allowed !. Thank you so much, Mapia

  12. #12
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi mapia... here's my two cents...

    Using combinatorics... there are 2,730 ( = 15*14*13) different 3-somes for a week with 15 names, while there are 143,640 ( = 21*20*19*18) different 4-somes for a week with 21 names. This is a simplistic view of the min and max number of team combinations.

    Will you ever reach that many different combinations?

  13. #13
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi mapia,

    I worked for about 3 days on this exact problem. That is, what if there is no way to combine people so no player had played with any of the others in the foursome. I believe it found a 4 person team who would fit the goal and then look for the next 4 some. If it tried 1000 tries it would stop and claim this was the best it could do. It would do its best to give the first few foursome no players who had previously played together but simply failed for the last few foursomes. I'd need to go back and review the code to see what is exactly is happening. You should try some small samples and see what the code does.

  14. #14
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi djapigo,

    This problem is a little different than normal permutation or combinations. Say you have 6 players and each needs to play once against each of the other players. This would be twosomes in golf with 6 total players in a Round Robin type of match. You would say there are 6*5 different ways to do this as suggested in your answer above. So let's try. Players are ABCDEF. We have:
    AB, AC, AD, AE, AF, BC, BD, BE, BF, CD, CE, CF, DE, DF, EF. This looks like all of them as BA would repeat AB, etc. Now say we take these same 6 players and put them in a threesome. We want to match them so no two players will play in a group with a player that they have played in before. ABC, DEF, AD..... There is only 1 round of golf with 6 players that matches what we want. I hope you are starting to see the problem. We were all taught permutations and combinations but how do you do this problem?
    Last edited by MarvinP; 03-19-2015 at 10:32 AM.

  15. #15
    Registered User
    Join Date
    03-08-2015
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    8

    Re: a list of 21 golfers not all playing each week , in teams of 4 or 3 , with no duplica

    Hi MarvinP,
    Thank you so much for your help here, quite amazing .

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Two columns of teams, count the number of times the teams meet?
    By tpe102 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-04-2013, 09:21 AM
  2. [SOLVED] Random Team Generator allowing Duplicates on separate teams
    By b_fruge in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-17-2013, 10:19 AM
  3. Generate 8-week schedule based on number of teams
    By JakeD in forum Excel General
    Replies: 0
    Last Post: 10-20-2011, 02:47 PM
  4. List teams in rank order from list
    By HuskerBronco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-27-2009, 10:03 AM
  5. Ranking of golfers
    By Tommy in forum Excel General
    Replies: 5
    Last Post: 04-07-2006, 01:35 PM

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