Combinations

User avatar
Don Wells
5StarLounger
Posts: 689
Joined: 27 Jan 2010, 16:45
Location: Ottawa, Ontario, Canada

Combinations

Post by Don Wells »

    A search of the Lounge failed to turn up any code for extracting all possible combinations of a given collection taken n at a time. I created the attached workbook with VBA code as a passtime activity.
    On my machine it will handle a collection of 24 items taken 11 at a time in 100 seconds. The same collection taken 12 at a time causes the machine to run out of memory while trying to redimension an array to 2.7 million by 12.

Enjoy; and feel free to criticize. :cheers:
You do not have the required permissions to view the files attached to this post.
Regards
Don

User avatar
HansV
Administrator
Posts: 78394
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Combinations

Post by HansV »

A nice companion to the thread about Permutations. :thankyou:
Best wishes,
Hans