I am seeking to generate a list of combinations without repetitions of data across three columns (Can be anywhere from two to four columns, but for the purposes of this specific example, sticking with three).
I am using MS Excel (latest version I believe)
Each Column has data in it (for purposes of explaining, the data is the alphabet, letter A through to N. So 14 rows).
The data in Column 1 to 3 is the exact same
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| A | A | A |
| B | B | B |
| ...down too | ||
| N | N | N |
What I am trying to solve is what are the unique three-column data combinations (i.e. without repetitions) that can be generated from these three columns with 14 rows, all with the exact same data.
As an example, a potential row (of many) could be....
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| A | B | c |
Of this one row, possible permutations are CAB, CBA, ABC, ACB, BCA, BAC.
Although each are different, for my purposes, 5 of these 6 are considered duplications. The combination of A, B and C, in any order, would be considered one unique combination. The same letters in a different order is a duplication.
This problem could be broken down into two stages
Stage 1 - Generating a list of all the permutations across the three columns and 14 rows. The output must be keep all the columns separate
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| A | A | A |
| A | A | B |
| A | B | A |
| B | A | A |
etc...
This would include all permutations with repetitions.
Stage 2 - Removing duplicates across all these permutations to get the unique combinations (i.e. combinations without repetitions).
Of the c.2,744 rows, a number of them would be considered duplicates (as outlined earlier...CAB and CBA are the same)
This second stage should still maintain all the data in their separate columns. Concatenating is simple to do if required.
Ideally, I would love something that easily solves for both stages, to improve efficiency.
For Problem Stage 1 - I have found a few things in various forums / websites which help, and I believe I have been able to generate.
For Problem Stage 2 - Again I have searched around for solutions and tried various formula's etc. however they don't work
Update: I have taken the approach suggested by DjC, with the results producing the desired outcome alongside providing the flexibility for a novice like me to adapt as required. See picture below for my little proof check -> https://i.stack.imgur.com/Fzwl9.png

If I understood you correctly, having 14 possible values (letter A..N) and 3 columns, you have 14 * 13 * 12 = 2184 possible combinations if no letter may occur more than once in one row.
As always 6 (3 * 2 *1) entries are simple variations, you end up with 2184/6 = 384 rows of data.
The following function
CreateAllEntrieswill create those entries (using a global array variableresult). You feed the routine with an array of possible values - in the example it's a list of characters from A..N, but you can fill the array with anything - and with the number of columns you want to fill (eg 3).The routine will create an array with the data, and you can do what you want with that array - in the example (see routine
FillSheetthat is used as test routine) I have written it to a sheet.As you can see, the function calls a routine
createEntrieswhich will call itself recursively, on level per column you want to fill. It iterates through all possible values that are not already taken.Note that I declared the
resultarray and the variablerowas globals for pure lazyness.