Try this:-
Results start "E1"
Sub MG28Oct35
Dim Dn As Range, k As Variant
Dim p As Variant, c As Long
Dim Rng As Range, Dic As Object
Set Rng = Range(Range("B2"), Range("B" & Rows.Count).End(xlUp))
Set Dic = CreateObject("Scripting.Dictionary")
Dic.CompareMode = 1
For Each Dn In Rng
If Not Dic.exists(Dn.Value) Then
Set Dic(Dn.Value) = CreateObject("Scripting.Dictionary")
End If
If Not Dic(Dn.Value).exists(Dn.Offset(, -1).Value) Then
Dic(Dn.Value).Add (Dn.Offset(, -1).Value), 1
Else
Dic(Dn.Value).Item(Dn.Offset(, -1).Value) = _
Dic(Dn.Value).Item(Dn.Offset(, -1).Value) + 1
End If
Next Dn
For Each k In Dic.Keys
c = c + 1
Cells(c, "E") = k
For Each p In Dic(k)
c = c + 1
Cells(c, "F") = p
Cells(c, "G") = Dic(k).Item(p)
Next p
Next k
End Sub
Regards Mick
Bookmarks