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
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
¤ñ¹ï«áµ²ªGÅã¥Ü¦b¦P¤@®æÀx¦s®æ¡A½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁ¡C
Sub µ²ªGÅã¥Ü¦P¤@®æ()
Dim Arr, Ar(), xD, xD2, T, i&, C%
Set xD = CreateObject("Scripting.Dictionary")
Set xD2 = CreateObject("Scripting.Dictionary")
Arr = Range("a1").CurrentRegion
ReDim Ar(1 To UBound(Arr), 0)
For i = 1 To UBound(Arr)
For j = 1 To UBound(Arr, 2)
T = Arr(i, j)
If i = 1 Then xD(T & "") = T: GoTo 99
If C = 0 Then
M = xD(T & ""): xD2(T & "") = T
If M > 0 Then Ar(i, 0) = Ar(i, 0) & "," & xD(T & "")
Else
M = xD2(T & ""): xD(T & "") = T
If M > 0 Then Ar(i, 0) = Ar(i, 0) & "," & xD2(T & "")
End If
99: Next
If i > 1 Then
If C = 0 Then
Ar(i, 0) = Mid(Ar(i, 0), 2): C = 1: Set xD = Nothing
Set xD = CreateObject("Scripting.Dictionary")
Else
Ar(i, 0) = Mid(Ar(i, 0), 2): C = 0: Set xD2 = Nothing
Set xD2 = CreateObject("Scripting.Dictionary")
End If
End If
Next
Range("N1").Resize(UBound(Arr)) = Ar
End Sub
²¤Æ¤@¤U#8¼Óµ{¦¡¡A¤£¦n·N«ä¡A«á¾Ç«ä¼{¤£°÷²Ó¤ß¡A¤@ª½¦AקﲤơA½Ð¦A´ú¸Õ¬Ý¬Ý¡AÁÂÁ¡C
Sub test3()
Dim Arr, xD, xD2, Ar(), T, i&, C%
Set xD = CreateObject("Scripting.Dictionary")
Set xD2 = CreateObject("Scripting.Dictionary")
Arr = Range("a1").CurrentRegion
For i = 1 To UBound(Arr)
ReDim Ar(1 To 1, 1 To UBound(Arr, 2))
For j = 1 To UBound(Arr, 2)
T = Arr(i, j)
If i = 1 Then xD(T & "") = T: GoTo 99
If C = 0 Then
M = xD(T & ""): xD2(T & "") = T
If M > 0 Then N = N + 1: Ar(1, N) = xD(T & "")
Else
M = xD2(T & ""): xD(T & "") = T
If M > 0 Then N = N + 1: Ar(1, N) = xD2(T & "")
End If
99: Next
If i > 1 Then
If C = 0 Then
Cells(i, 15).Resize(1, N) = Ar
C = 1: Erase Ar: Set xD = Nothing: N = 0
Set xD = CreateObject("Scripting.Dictionary")
Else
Cells(i, 15).Resize(1, N) = Ar
C = 0: Erase Ar: Set xD2 = Nothing: N = 0
Set xD2 = CreateObject("Scripting.Dictionary")
End If
End If
Next
End Sub
Sub test2()
Dim Arr, xD, xD2, Ar(), T, i&, C%
Set xD = CreateObject("Scripting.Dictionary")
Set xD2 = CreateObject("Scripting.Dictionary")
Arr = Range("a1").CurrentRegion
For i = 1 To UBound(Arr)
ReDim Ar(1 To 1, 1 To UBound(Arr, 2))
For j = 1 To UBound(Arr, 2)
T = Arr(i, j)
If i = 1 Then xD(T & "") = T: GoTo 99
If C = 0 Then
M = xD(T & "")
If M > 0 Then N = N + 1: Ar(1, N) = xD(T & "")
xD(T & "") = T: xD2(T & "") = T
Else
M = xD2(T & "")
If M > 0 Then N = N + 1: Ar(1, N) = xD2(T & "")
xD(T & "") = T: xD2(T & "") = T
End If
99: Next
If i > 1 Then
If C = 0 Then
Cells(i, 15).Resize(1, N) = Ar
C = 1: Erase Ar: Set xD = Nothing: N = 0
Set xD = CreateObject("Scripting.Dictionary")
Else
Cells(i, 15).Resize(1, N) = Ar
C = 0: Erase Ar: Set xD2 = Nothing: N = 0
Set xD2 = CreateObject("Scripting.Dictionary")
End If
End If
Next
End Sub