how to get every possible combinations in a set formula code example

Example: how to remove each possible combination excel

Sub kalx()

Dim Qix As Object, a, i As Long, r As Long, rs As Long
Set Qix = CreateObject("scripting.dictionary")
Set a = Range("A1").CurrentRegion.Resize(, 3)

For i = 2 To a.Rows.Count
    a.Rows(i).Sort a(i, 1), Header:=xlNo, Orientation:=xlLeftToRight
    Qix(Join(Array(a(i, 1), a(i, 2), a(i, 3)), Chr(2))) = 1
Next i

a.Offset(1).ClearContents: r = 1
For Each c In Qix.keys
    r = r + 1
    a(r, 1).Resize(, 3) = Split(c, Chr(2))
Next c

End Sub

Tags:

Misc Example