Consulting

Results 1 to 20 of 26

Thread: find all combinations (no repeats)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location

    find all combinations (no repeats)

    I'm trying to figure out a way to list all possible combinations (no repeats) of any list of items (I'm using numbers for now to make it simpler). Anything beyond 16 items would be too many rows for Excel to display. 16 items = (2^16)-1 = 65535 possible combinations (rows)

    By no repeats, i mean: 1,2,3 and 2,3,1 would be the same item combination (not 2 different ones).

    Anyway, I've attached the file as it is so far, but I'm missing the part where it actually outputs the subsets, like sets of 2, sets of 3, etc. I would like the output to start in F1 and go down.

    I have searched this site and google all day with very little promising results. There's a ton of samples, but none of them showed a general formula or code that would handle this type of thing.

    Can anyone walk me through this? This is not homework. I'm doing this as a curious experiment because I had the need to show all possible combinations (by using different colored dots on a map) at work and had to do it in my head. I knew there had to be an easier way.

    If there's a solution via formulas instead of VBA I would like to see how that would work too. Also, my mapping program allows me to query things with SQL. If any SQL expert out there knows of a way to do this automatically via SQL, that'd be awesome too.

    Thanks,
    Tom
    Attached Files Attached Files
    Office 2010, Windows 7
    goal: to learn the most efficient way

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •