Sub qs()
Dim arr, brr, i, clm
clm = 6
With Sheet1
Sheet10.Range("b4:ao4") = ""
arr = .Range("a4:m" & .Cells(Rows.Count, 1).End(xlUp).Row)
Sheet10.Cells(4, 3) = Application.Sum(Application.Index(arr, 0, 13))
Sheet10.Cells(4, 4) = Application.Average(Application.Index(arr, 0, 13))
Sheet10.Cells(4, 5) = Application.Max(Application.Index(arr, 0, 13))
Sheet10.Cells(4, 6) = Application.Min(Application.Index(arr, 0, 13))
Sheet10.Cells(4, 2) = UBound(arr)
a = [{630,620,610,600,590,580,570,560,550,540,530,520,510,500,490,480,470,460,450,440,430,420,410,400,390,380,370,360,350,340,330,320,310,300,299.99999}]
For i = 1 To UBound(a)
clm = clm + 1
For j = 1 To UBound(arr)
If i = 1 Then
If arr(j, 13) >= a(i) Then
Sheet10.Cells(4, clm) = Sheet10.Cells(4, clm) + 1
End If
ElseIf i = UBound(a) Then
If arr(j, 13) < a(i) Then
Sheet10.Cells(4, clm) = Sheet10.Cells(4, clm) + 1
End If
Else
If arr(j, 13) < a(i - 1) And arr(j, 13) >= a(i) Then
Sheet10.Cells(4, clm) = Sheet10.Cells(4, clm) + 1
End If
End If
Next
Next
End With
End Sub
|