Sub TEST_A1()
Dim Arr, Brr, xD, i&, j%, R&, D
Set xD = CreateObject("Scripting.Dictionary")
Brr = Range([h2], [e65536].End(3)(2))
For i = 1 To UBound(Brr) - 1
xD(Brr(i, 1)) = i: Brr(i, 1) = 0
Brr(i, 2) = CDate(Brr(i, 2)): Brr(i, 3) = CDate(Brr(i, 3))
Next i
Arr = Range([a1], [c65536].End(3))
For i = 2 To UBound(Arr)
R = xD(Arr(i, 1)): D = CDate(Arr(i, 2))
If R = 0 Then GoTo i01
If D >= Brr(R, 2) And D <= Brr(R, 3) Then Brr(R, 1) = Brr(R, 1) + Arr(i, 3)
i01: Next i
[h2].Resize(UBound(Brr) - 1) = Brr
End Sub
|