Hello nocty,
The attached workbook has 2 sheets: List and Report. The List contains the example data you posted. The Report sheet contains the names and the counts. This macro could be adapted to your workbook. However, without seeing your workbook I can't make any needed adjustments. The macro below has been added to a button on the List sheet.
Sub CreateReport()
Dim Cell As Range
Dim DSO As Object
Dim Item As Variant
Dim Key As String
Dim ListWks As Worksheet
Dim ReportWks As Worksheet
Dim Rng As Range
Dim RngEnd As Range
Set ListWks = Worksheets("List")
Set ReportWks = Worksheets("Report")
Set Rng = ListWks.Range("A2:B2")
Set RngEnd = ListWks.Cells(Rows.Count, Rng.Column).End(xlUp)
Set Rng = IIf(RngEnd.Row < Rng.Row, Rng, ListWks.Range(Rng, RngEnd))
Set DSO = CreateObject("Scripting.Dictionary")
DSO.CompareMode = vbTextCompare
ReportWks.UsedRange.Offset(1, 0).ClearContents
For Each Cell In Rng.Columns(1).Cells
Key = Trim(Cell)
Item = Cell.Offset(0, 1).Value
If Not DSO.Exists(Key) Then
DSO.Add Key, Item
Else
DSO(Key) = DSO(Key) + Item
End If
Next Cell
ReportWks.Cells(2, "A").Resize(DSO.Count, 1) = WorksheetFunction.Transpose(DSO.Keys)
ReportWks.Cells(2, "B").Resize(DSO.Count, 1) = WorksheetFunction.Transpose(DSO.Items)
Set DSO = Nothing
End Sub
Bookmarks