
Originally Posted by
vba_php
can you post what you've already tried? the code to do this is very simple, but i would be interested to see what you've tried first. and by the way, SUMIF() will work for millions of lines of data. the count of rows is irrelevant. I just thought you could use it to your advantage.
I need to use VBA dictionar.
Sub test()
Dim a, i As Long, txt As String, dic As Object
Set dic = CreateObject("Scripting.Dictionary")
a = Sheets("Sheet1").Range("A1:E11")
For i = 1 To UBound(a, 1)
txt = Join(Array(a(i, 1), a(i, 2), a(i, 3), a(i, 4)), Chr(2))
dic(txt) = dic(txt) + a(i, 4)
Next
With Sheets.Add.Cells(1).Resize(, UBound(a, 2))
.Value = Array("ID", "Farm", "Department", "Work Time", "Date")
I learned this type of code in a tutorial but the tutorial aim was something else. I tried to solve my problem by that dictionary method but I failed. I'm sure VBA dictionary can do it.
Bookmarks