|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("VBA")
- .Range("c3:c4,e3:e4,g3:g4").ClearContents
- .Range("c7:d9").ClearContents
- brr = .Range("a3:g4")
- crr = .Range("c7:d9")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("c10:d" & r)
- rs = UBound(arr) - Application.Round(UBound(arr) * 0.05, 0)
- For j = 1 To UBound(arr, 2)
- fs = Application.Large(Application.Index(arr, 0, j), rs)
- s = 0
- For i = 1 To UBound(arr)
- If arr(i, j) >= 90 Then
- brr(j, 3) = brr(j, 3) + 1
- End If
- If arr(i, j) >= 60 Then
- brr(j, 5) = brr(j, 5) + 1
- End If
- brr(j, 7) = brr(j, 7) + arr(i, j)
-
- If arr(i, j) >= fs Then
- s = s + 1
- If arr(i, j) >= 60 Then
- crr(1, j) = crr(1, j) + 1
- End If
- If arr(i, j) >= 90 Then
- crr(2, j) = crr(2, j) + 1
- End If
- crr(3, j) = crr(3, j) + arr(i, j)
- End If
- Next
- crr(3, j) = crr(3, j) - (s - rs) * rs
- Next
- For i = 1 To 2
- For j = 3 To 7 Step 2
- brr(i, j) = Application.Round(brr(i, j) / UBound(arr), 4)
- Next
- Next
- For i = 1 To 3
- For j = 1 To 2
- crr(i, j) = Application.Round(crr(i, j) / rs, 4)
- Next
- Next
- .Range("a3:g4") = brr
- .Range("c7:d9") = crr
- End With
- End Sub
复制代码 |
|