R
Robert Crandal
Suppose I have all possible combinations of a set of 7
numbers chosen 5 at a time. (i.e 7-choose-5). There would
be a set of 21 total combos, which are listed below:
Combo #1) 1-2-3-4-5
Combo #2) 1-2-3-4-6
Combo #3) 1-2-3-4-7
Combo #4) 1-2-3-5-6
Combo #5) 1-2-3-5-7
Combo #6) 1-2-3-6-7
Combo #7) 1-2-4-5-6
Combo #8) 1-2-4-5-7
Combo #9) 1-2-4-6-7
Combo #10 1-2-5-6-7
Combo #11) 1-3-4-5-6
Combo #12) 1-3-4-5-7
Combo #13) 1-3-4-6-7
Combo #14) 1-3-5-6-7
Combo #15) 1-4-5-6-7
Combo #16) 2-3-4-5-6
Combo #17) 2-3-4-5-7
Combo #18) 2-3-4-6-7
Combo #19) 2-3-5-6-7
Combo #20) 2-4-5-6-7
Combo #21) 3-4-5-6-7
I'm trying to devise some sort of function that will associate a
unique identifier for each combination. So, if the combination of
"1 2 3 4 5" is given as input, then my function should return a "1"
(since this is the 1st combo in the list). If "1 3 4 5 7" is given as
input, then the number 12 should be returned, since that is the 12th combo
above. Does that make sense?
I'm basically trying to find a way to generate a unique identifier for any
5-combination that is given as input. It would be nice if the solution
could
be applied to a general set of combos, such as N-choose-5.
Does anyone have any ideas? I know this problem isn't really related to
VBA, but I trust the wisdom of everybody here.
Thanks everyone.
numbers chosen 5 at a time. (i.e 7-choose-5). There would
be a set of 21 total combos, which are listed below:
Combo #1) 1-2-3-4-5
Combo #2) 1-2-3-4-6
Combo #3) 1-2-3-4-7
Combo #4) 1-2-3-5-6
Combo #5) 1-2-3-5-7
Combo #6) 1-2-3-6-7
Combo #7) 1-2-4-5-6
Combo #8) 1-2-4-5-7
Combo #9) 1-2-4-6-7
Combo #10 1-2-5-6-7
Combo #11) 1-3-4-5-6
Combo #12) 1-3-4-5-7
Combo #13) 1-3-4-6-7
Combo #14) 1-3-5-6-7
Combo #15) 1-4-5-6-7
Combo #16) 2-3-4-5-6
Combo #17) 2-3-4-5-7
Combo #18) 2-3-4-6-7
Combo #19) 2-3-5-6-7
Combo #20) 2-4-5-6-7
Combo #21) 3-4-5-6-7
I'm trying to devise some sort of function that will associate a
unique identifier for each combination. So, if the combination of
"1 2 3 4 5" is given as input, then my function should return a "1"
(since this is the 1st combo in the list). If "1 3 4 5 7" is given as
input, then the number 12 should be returned, since that is the 12th combo
above. Does that make sense?
I'm basically trying to find a way to generate a unique identifier for any
5-combination that is given as input. It would be nice if the solution
could
be applied to a general set of combos, such as N-choose-5.
Does anyone have any ideas? I know this problem isn't really related to
VBA, but I trust the wisdom of everybody here.
Thanks everyone.