I currently have a spreadsheet that is filled with functions and. using macros. loops through thousands of potential combinations searching for the best possible solution. This is all being done to try and match up tennis players who have competed the least amount of times against one another... and, to top that off... they rotate partners after each set. I have discovered that when you only have 5 players to examine, this is fairly simple process. There are only so many combination of players to deal with. When you have 12 or more players AND more than one tennis court available to play on, it becomes much more complicated.
My spreadsheet currently utilizes the =combinations(A8:A28,4) function. Where A8:A28 contains my candidates for playing (signified by a number available to play such as 1, 2, 3, etc.) and 4 being the number of people playing together.
The spreadsheet seems works fine for groups of 8 or less (i.e., two courts). But it takes more than 20 seconds to complete because with 8 people there are a total of 1820 combinations. Once I get to 12 or more (i.e., 3 or more courts)... we begin to get into minutes... not seconds.
I was trying to figure out a way to reduce the time it takes the program to loop through all of this and the only possible solution I came up with was to try and use arrays in VBA. It is my understanding that using arrays would not require spreadsheet functions to constantly calculate every time I force it to loop through the potential "combination" of 4 candidates in hopes of finding the best match. This is because it would not be writing to the spread sheet each and every time I loop through another potential set of candidates. Is that correct?
If so, here is what I will know.
1. I will know the size of the array based on the number of players that will be available each week and the number of courts available to play on.
My question is... is it possible to populate an array using the =combinations(A8:A28,4) function? And if so, might someone have a suggestion how to accomplish that?
This is just my first step but finding out if using arrays this way is possible and more efficient that my current approach. If so, then I would be encouraged to do more research to try and figure out how to make this work.
I appreciate any help or direction you can provide.
Thank you,
Don
My spreadsheet currently utilizes the =combinations(A8:A28,4) function. Where A8:A28 contains my candidates for playing (signified by a number available to play such as 1, 2, 3, etc.) and 4 being the number of people playing together.
The spreadsheet seems works fine for groups of 8 or less (i.e., two courts). But it takes more than 20 seconds to complete because with 8 people there are a total of 1820 combinations. Once I get to 12 or more (i.e., 3 or more courts)... we begin to get into minutes... not seconds.
I was trying to figure out a way to reduce the time it takes the program to loop through all of this and the only possible solution I came up with was to try and use arrays in VBA. It is my understanding that using arrays would not require spreadsheet functions to constantly calculate every time I force it to loop through the potential "combination" of 4 candidates in hopes of finding the best match. This is because it would not be writing to the spread sheet each and every time I loop through another potential set of candidates. Is that correct?
If so, here is what I will know.
1. I will know the size of the array based on the number of players that will be available each week and the number of courts available to play on.
My question is... is it possible to populate an array using the =combinations(A8:A28,4) function? And if so, might someone have a suggestion how to accomplish that?
This is just my first step but finding out if using arrays this way is possible and more efficient that my current approach. If so, then I would be encouraged to do more research to try and figure out how to make this work.
I appreciate any help or direction you can provide.
Thank you,
Don