|
楼主 |
发表于 2018-11-19 16:22
|
显示全部楼层
Sub gj23w98()
Set d = CreateObject("scripting.dictionary")
Set d1 = CreateObject("scripting.dictionary")
arr = Range("a2:b" & Cells(Rows.Count, "a").End(3).Row): ReDim br(1 To UBound(arr), 1 To 1)
For i = 1 To UBound(arr)
s = Format(arr(i, 1), "yyyy-m-d")
If arr(i, 1) <> "" Then
d(s) = d(s) + arr(i, 2)
d1(s) = d1(s) + 1
End If
Next
For i = 1 To UBound(arr)
s = Format(arr(i, 1), "yyyy-m-d"): br(i, 1) = Application.Round(arr(i, 2) / (d(s) / d1(s)), 3)
Next
Cells(2, "c").Resize(UBound(br), 1) = br
End Sub |
|