Posted to microsoft.public.excel.programming
|
|
Creating a Macro
Of course, this formula does not describe his problem precisely, but gives
some insight into magnitudes.
--
Regards,
Tom Ogilvy
"Tom Ogilvy" wrote in message
...
Or use the combinations function directly
=combin(20,5)
as expected, also gives15504
--
Regards,
Tom Ogilvy
"Nancy Moon" wrote in message
...
Have you looked at the factorial function in excel to provide an idea
of how many sets you will get. FACT()
For the math see: http://mathworld.wolfram.com/Combination.html
The number of ways of picking k unordered outcomes from n
possibilities
where n = 20 and k=5
n!/k!(n-k)!
fact(20)/fact(5)*fact(20-5)
Number of possible outcomes 15504
In the equation ! exclamation means factorial.
Nancy Moon
On Sat, 5 Mar 2005 00:53:02 -0800, "DeRizzio"
wrote:
I would like to create a macro that gives the different results for the
following
Question:
I have 20 numbers (1-20) that are broken down into three groups. How
can
I
create a macro that generates different sets of 3 groups of numbers,
that
when any 5 numbers are picked at random, at least four (80%) of the
five
numbers will be in a group? Each number is used once per set. The
objective
is to generate the least amount of sets to accomplish this goal.
Partial Answer:
Set 1
Group 1 = 1, 2, 3, 4, 5, 6, 7
Group 2 = 8, 9, 10, 11, 12, 13, 14
Group 3 = 15, 16, 17, 18, 19, 20
Set 2
Group 1 = 20, 14, 6, 18, 10, 12, 4
Group 2 = 16, 8, 2, 3, 7, 11, 15
Group 3 = 1, 5, 9, 11, 17, 19
Set 3
Group 1 = 3, 6, 9, 12, 15, 18 1
Group 2 = 4, 7, 10, 13, 16, 19, 5
Group 3 = 2, 8, 11, 14, 17, 20
And so on.....
In other words,
Question:
I have 20 employees that on average 5 of them will complain about
different
working conditions (or other problems) per month. Each employee will
be
listed/named 1-20 in excel. The 20 employees are broken down into 3
groups.
How many different sets of 3 groups (numbered 1-20 where each number
can
only
be used once per set) will I have to create to have at least 4 out of 5
random complaints end up in the same group? The objective is to
accomplish
this goal by using the least amount of sets.
Can I create a macro for this? I'm using Microsoft Excel 2002. Thanks
___________________
|