Complex List Generator- Multiple Lists, Multiple Choose N's, Millions of Results

SuperNerd

New Member
Joined
Sep 16, 2020
Messages
37
Office Version
  1. 365
Platform
  1. Windows
I have 13 lists, with 4 values in each.

VBA Code:
1a    1b    1c    1d
2a    2b    2c    2d
3a    3b    3c    3d
4a    4b    4c    4d
5a    5b    5c    5d
6a    6b    6c    6d
7a    7b    7c    7d
8a    8b    8c    8d
9a    9b    9c    9d
10a    10b    10c    10d
11a    11b    11c    11d
12a    12b    12c    12d
13a    13b    13c    13d

I need to generate all possible combinations with some special requirements:
1) No value can repeat itself within a resulting combination set. (ie- combination result: {2a, 7b, 11d, 2a)- this is disallowed as '2a' is repeated)
2) No resulting combination set can have another value from it's own list (ie- combination result: {4c, 6d, 9a, 9c, 13a} - this is disallowed as 9a and 9c are from the same list)
3) I need to be able to choose all combinations in resulting sets of 2, 3, 4 and 5 values. (examples- {1c, 9b}, {2a, 7c, 8d}, {4a, 5c, 11b, 13d}, {7a, 8a, 10c, 11b, 12a}

I realize this results in 1+MIL results. It's a pretty complex workbook we're generating. :)

I've spent nearly a week full time searching and searching and not coming up with a way to do this. I'm sure Power Query is the best way, but am wide open to any method that gets me the results. I'd appreciate any help you can give- the boss is putting pressure on me and I'm really stuck!
Thank you!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
FYI- Not sure if it matters, but my actual data is transposed where I have 13 columns (one for each list) and 4 rows... again, probably doesn't matter, and I can transpose either direction to make it work for a solution... ;)
 
Upvote 0
so which one you want to use for Cartesian?
Column1Column2Column3Column4Column1Column2Column3Column4Column5Column6Column7Column8Column9Column10Column11Column12Column13
1a1b1c1d1a2a3a4a5a6a7a8a9a10a11a12a13a
2a2b2c2d1b2b3b4b5b6b7b8b9b10b11b12b13b
3a3b3c3d1c2c3c4c5c6c7c8c9c10c11c12c13c
4a4b4c4d1d2d3d4d5d6d7d8d9d10d11d12d13d
5a5b5c5d
6a6b6c6d
7a7b7c7d
8a8b8c8d
9a9b9c9d
10a10b10c10d
11a11b11c11d
12a12b12c12d
13a13b13c13d
 
Upvote 0
Hi thanks for the reply. I’d prefer the 2nd/green one. I didn’t think it was a full Cartesian as all the examples of Cartesian have the same number of ‘choose’ as their are lists. Ie- since I have 13 lists, the Cartesian process would have 13 members in each set... and I need all combinations with 2 up to 5 members in each set.
Is there a way to do that?
Thank you!
 
Upvote 0
so you need something like this?
an example
1a
1a2a
1a2a3a
1a2a3a4a
1a2a3a4a5a

or post expected result. Use XL2BB to do that
 
Upvote 0
Yeah I guess. But within those requirements I posted. No repeats, none on the same row from the same column/list etc.
thank you!!!
 
Upvote 0
Ok I’ll have to whip that up and post in the morning. I know there’s 1.4mil results tho so do you just want me to post some of each size result like in my example? Or a bunch of each one?
 
Upvote 0
haha! OK- how about something like this? Each variable within an individual cell... doesn't have to be in order.

sample.csv
ABCDE
404b13c
413c5b
428a11a
434a6a9b
444d7d12d
452b6c8a
4612b10c4c
472a4c7d5d
4810a4b6d1b
497a13c5c11b
502a8c9c13c6d
511d3d8b10b11c
523a5b6c10c12b
IndCombos
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top