Sub Test()
Dim T0, T1, T2 As Variant
T0 = Range(Cells(2, 1), Cells(Cells(65536, 1).End(xlUp).Row, 1))
ReDim Preserve T0(LBound(T0, 1) To UBound(T0, 1), LBound(T0, 1) To 2)
For i = LBound(T0, 1) To UBound(T0, 1)
For j = i + 1 To UBound(T0, 1)
If T0(i, 1) = T0(j, 1) Then
T0(j, 2) = "D"
End If
Next j
Next i
ReDim T1(0)
For i = LBound(T0, 1) To UBound(T0, 1)
If T0(i, 2) <> "D" Then
T1(UBound(T1)) = T0(i, 1)
ReDim Preserve T1(UBound(T1) + 1)
End If
Next i
ReDim Preserve T1(UBound(T1) - 1)
'
Cells(3, 8).Resize(UBound(T1) + 1) = Application.Transpose(T1)
Erase T0
T0 = Range(Cells(2, 1), Cells(Cells(65536, 1).End(xlUp).Row, 4))
ReDim T2(0)
For i = LBound(T1) To UBound(T1)
T2(0) = T1(i)
For j = LBound(T0, 1) To UBound(T0, 1)
If T1(i) = T0(j, 1) And T0(j, 2) <> "" Then
If T0(j, 2) > T0(j, 3) Then
ReDim Preserve T2(UBound(T2) + 1)
T2(UBound(T2)) = "V"
ElseIf T0(j, 2) < T0(j, 3) Then
ReDim Preserve T2(UBound(T2) + 1)
T2(UBound(T2)) = "D"
Else
ReDim Preserve T2(UBound(T2) + 1)
T2(UBound(T2)) = "N"
End If
End If
Next j
Cells(i + 3, 8).Resize(LBound(T2) + 1, UBound(T2) + 1) = T2
Erase T2
ReDim T2(0)
Next i
End Sub