Sub TEST_A01()
Dim Arr, xD, i&, j%, T$, TT$
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([m1], [a65536].End(xlUp))
For i = 1 To UBound(Arr)
For j = 1 To UBound(Arr, 2)
T = Arr(i, j): xD(T & "/" & i) = 1
If xD(T & "/" & i - 1) = 1 Then TT = TT & "," & T
Next j
Arr(i, 1) = Mid(TT, 2): TT = ""
Next i
[p1].Resize(UBound(Arr)) = Arr
End Sub
Sub TEST_A02()
Dim Arr, Brr, xD, i&, j%, TT$
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([m1], [a65536].End(xlUp))
ReDim Brr(1 To UBound(Arr), 0)
For i = 2 To UBound(Arr)
For j = 1 To UBound(Arr, 2)
xD(Arr(i - 1, j) & "") = 1
Next j
For j = 1 To UBound(Arr, 2)
If xD(Arr(i, j) & "") = 1 Then TT = TT & "," & Arr(i, j)
Next j
Brr(i, 0) = Mid(TT, 2): TT = "": xD.RemoveAll
Next i
[p1].Resize(UBound(Brr)) = Brr
End Sub