|
- Sub shishi()
- Dim brr()
- Set d = CreateObject("scripting.dictionary")
- arr = Range("a1").CurrentRegion
- sd = #3/26/2024#: ld = #4/25/2024#
- For i = 2 To UBound(arr)
- If CDate(arr(i, 7)) >= sd And CDate(arr(i, 7)) <= ld Then
- Key = arr(i, 1) & "," & arr(i, 2) & "," & arr(i, 3) & "," & arr(i, 4) & "," & arr(i, 5) & "," & arr(i, 6)
- If Not d.exists(Key) Then
- d(Key) = i
- Else
- d(Key) = d(Key) & "," & i
- End If
- End If
- Next
- ReDim brr(1 To d.Count, 1 To 9)
- For Each Key In d.keys
- n = n + 1: s = 0
- tt = Split(Key, ",")
- For j = 0 To 5
- brr(n, j + 1) = tt(j)
- Next
- ss = Split(d(Key), ",")
- For i = 0 To UBound(ss)
- If arr(ss(i), 11) <> 0 Then grjj = arr(ss(i), 11)
- s = s + arr(ss(i), 8)
- Next
- zdjj = s / (UBound(ss) + 1)
- brr(n, 7) = Round(zdjj, 2): brr(n, 8) = grjj: brr(n, 9) = Round((zdjj - grjj), 2)
- Next
- [o8].Resize(n, 9) = brr
- End Sub
复制代码
|
|