'成績統計...by.准提部林
Sub Test_A1()
Dim Arr, Brr(1 To 2000, 1 To 13), xD, i&, j%, T$, P$, N&, R&, C%, V, xS As Worksheet
Set xD = CreateObject("scripting.dictionary")
Arr = Sheet1.UsedRange
For j = 5 To 12
T = Arr(3, j) & "统计 ": Set xS = Nothing
On Error Resume Next: Set xS = Sheets(T): On Error GoTo 0
If xS Is Nothing Then GoTo j01
For i = 4 To UBound(Arr)
P = Arr(i, 1): R = xD(P): V = Arr(i, j)
If R = 0 Then N = N + 1: R = N: xD(P) = N: Brr(N, 1) = P
Brr(R, 2) = Brr(R, 2) + 1
If V <> "" Then Brr(R, 3) = Brr(R, 3) + 1
Brr(R, 12) = Brr(R, 12) + V
C = Switch(V >= 90, 4, V >= 80, 6, V >= 70, 8, V >= 60, 10, V = V, 0)
If C > 0 Then
Brr(R, C) = Brr(R, C) + 1
Brr(R, C + 1) = Round(Brr(R, C) / Brr(R, 3), 4)
End If
Next i
xS.UsedRange.Offset(3).EntireRow.Delete
If N = 0 Then GoTo j01
With xS.[a4].Resize(N, 13)
.Value = Brr
.Columns(13) = "=RANK(L4,L:L)"
End With
j01: Erase Brr: N = 0: xD.RemoveAll
Next j
End Sub
|