View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Max Max is offline
external usenet poster
 
Posts: 9,221
Default COMBIN and listing - Help Required Please.

Another play is to use Myrna Larson's power subroutine
to generate the combinations ..

Take away this implemented sample from my archives:
http://www.savefile.com/files/518493
MyrnaLarson_Combination_Permutation.xls
(full details inside, ready to run

In the sample file,
In Sheet1,
1. Enter the letter C or P in A1 (C = combinations, P = permutations), ie
enter: C
2. Enter the number of items involved per combo in A2, ie enter: 3
3. Enter/List the 6 items in A3 down, ie list in A3:A8 :1, 2, ... 6
4. Select A1 (this cell selection is required), then click the button
ListPermutations to run the sub ListPermutations
5. The results will be written to a new sheet (just to the left),and appear
like below, in a zig-zag manner* until all combos are exhausted:
*if it exceeds the rows limit of 65536 in xl97 to xl2003

1, 2, 3
1, 2, 4
1, 2, 5
1, 2, 6
....
4, 5, 6

Go easy when you *ramp* up the generation ...
eg a "Pick 6 out of 45" run works out to a staggering:
=COMBIN(45,6) = 8,145,060 combinations
so almost half** an entire sheet would be populated

**A single sheet in xl97 to xl2003 houses:
=65536 rows x 256 cols = 16,777,216 cells

The sub would certainly need time to complete generation
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Terry" wrote in message
...
I am looking for some assistance to achieve the following which I
would prefer if possible to be able to carry out by using formula
functions rather than macros which are not my forte.

I have used the COMBIN formula to achieve the figures I require,

eg: COMBIN(6,3) to give me 20

what I need is a formula that will actually list the 20 unique
combinations,

ie:

1 2 3
1 2 4
1 2 5
1 2 6
2 3 4
2 3 5

etc. etc.

I have many of these of varying figures to carry out and to enter them
by hand would be laborious and open to human error.

I would appreciate any help or advise.

Thank you in advance,

Terry.