I think I found my own answer:
Sub test()
Dim a, i As Long, txt As String, dic As Object
Set dic = CreateObject("Scripting.Dictionary")
a = Sheets("Sheet1").Range("A2:E11")
For i = 1 To UBound(a, 1)
txt = Join(Array(a(i, 1), a(i, 2), a(i, 3), a(i, 5)), Chr(2))
dic(txt) = dic(txt) + a(i, 4)
Next
With Sheets.Add.Cells(1).Resize(, UBound(a, 2))
.Value = Array("ID", "Farm", "Department", "Date", "Work Time")
With .Rows(2).Resize(dic.Count)
With .Columns(1)
.Value = Application.Transpose(dic.Keys)
.TextToColumns .Cells(1), 1, other:=True, otherchar:=Chr(2)
End With
.Columns(.Columns.Count).Value = Application.Transpose(dic.Items)
.Sort .Cells(1, 1), 1, , Cells(1, 2), 1
End With
.CurrentRegion.Columns.AutoFit
End With
End Sub
Bookmarks