excelNewbie22
Well-known Member
- Joined
- Aug 4, 2021
- Messages
- 528
- Office Version
- 365
- Platform
- Windows
hi,
i need a way to generate Permutations with no repeats, and no duplicates
either with a formula or an udf,
so if i have the numbers: 1-2-3-4 i'll get:
[1,2,3,4],[1,2,4,3],[1,3,2,4],[1,3,4,2],[1,4,2,3],[1,4,3,2],[2,1,3,4],[2,1,4,3],[2,3,1,4],[2,3,4,1],[2,4,1,3],[2,4,3,1],[3,1,2,4],[3,1,4,2],[3,2,1,4],[3,2,4,1],[3,4,1,2],[3,4,2,1],[4,1,2,3],[4,1,3,2],[4,2,1,3],[4,2,3,1],[4,3,1,2],[4,3,2,1]
ignore the brackets
total of 24 permutations with no duplicates
and, this is the problematic part, if i have 1-2-3-3 i want to get:
[1,2,3,3],[1,3,2,3],[1,3,3,2],[2,1,3,3],[2,3,1,3],[2,3,3,1],[3,1,2,3],[3,1,3,2],[3,2,1,3],[3,2,3,1],[3,3,1,2],[3,3,2,1]
total of 12 only, with no duplicates
and if 1-2-2-2 i want to get: [1,2,2,2],[2,1,2,2],[2,2,1,2],[2,2,2,1] only 4 in total
found an udf in get-digital-help.com but it return duplicates,
also i have this:
but it returned all premutations with duplicates and repetitions
can it be done?
i need a way to generate Permutations with no repeats, and no duplicates
either with a formula or an udf,
so if i have the numbers: 1-2-3-4 i'll get:
[1,2,3,4],[1,2,4,3],[1,3,2,4],[1,3,4,2],[1,4,2,3],[1,4,3,2],[2,1,3,4],[2,1,4,3],[2,3,1,4],[2,3,4,1],[2,4,1,3],[2,4,3,1],[3,1,2,4],[3,1,4,2],[3,2,1,4],[3,2,4,1],[3,4,1,2],[3,4,2,1],[4,1,2,3],[4,1,3,2],[4,2,1,3],[4,2,3,1],[4,3,1,2],[4,3,2,1]
ignore the brackets
total of 24 permutations with no duplicates
and, this is the problematic part, if i have 1-2-3-3 i want to get:
[1,2,3,3],[1,3,2,3],[1,3,3,2],[2,1,3,3],[2,3,1,3],[2,3,3,1],[3,1,2,3],[3,1,3,2],[3,2,1,3],[3,2,3,1],[3,3,1,2],[3,3,2,1]
total of 12 only, with no duplicates
and if 1-2-2-2 i want to get: [1,2,2,2],[2,1,2,2],[2,2,1,2],[2,2,2,1] only 4 in total
found an udf in get-digital-help.com but it return duplicates,
also i have this:
Excel Formula:
=INDEX(A2:D2,MID(BASE(SEQUENCE(PERMUTATIONA(COUNTA(A2:D2),4))-1,COUNTA(A2:D2),4),SEQUENCE(,4),1)+1)
can it be done?