'分數段統計//by.准提部林
Sub Test_A1()
Dim Arr, Brr, xD, i&, V, T$, R&, C%, N&
Set xD = CreateObject("scripting.dictionary")
Arr = Range(Sheet1.[b1], Sheet1.[a65536].End(3))
ReDim Brr(1 To UBound(Arr), 1 To 5)
For i = 2 To UBound(Arr)
T = Arr(i, 1): V = Arr(i, 2): R = xD(T)
If R = 0 Then N = N + 1: R = N: xD(T) = R: Brr(R, 1) = T
C = Switch(V >= 100, 2, V >= 90, 3, V >= 70, 4, V >= 50, 5, V = V, 0)
If C > 0 Then Brr(R, C) = Brr(R, C) + 1
Next i
With Sheet1.[c2].Resize(N, 5)
.Value = Brr
.Sort Key1:=.Item(1), Order1:=xlAscending, Header:=xlNo
End With
End Sub
|