I added the macro to your file. I added a reference to "Microsoft Scriping Runtime"
Sub CollectData()
Dim dict As New Dictionary
Dim i As Long
Dim vArr As Variant
Dim Keys As Variant
'read data into variant array
vArr = ActiveSheet.Range("F1").CurrentRegion
' collect data below header till end
For i = 2 To UBound(vArr, 1)
If dict.Exists(CStr(vArr(i, 1))) Then
dict.Item(CStr(vArr(i, 1))) = dict.Item(CStr(vArr(i, 1))) + CInt(vArr(i, 3))
Else
dict.Add CStr(vArr(i, 1)), CInt(vArr(i, 3))
End If
Next
'--- test output ---
' copy summary data to sheet
i = 5
For Each Keys In dict.Keys
i = i + 1
ActiveSheet.Cells(i, 1) = Keys
ActiveSheet.Cells(i, 2) = dict.Item(CStr(Keys))
Next
End Sub
Bookmarks