|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test3()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("求助表格")
- arr = .Range("a2:o30")
- ReDim brr(1 To 4, 1 To 7)
- For j = 4 To 10
- brr(1, j - 3) = arr(2, j)
- For i = 3 To UBound(arr)
- If Len(arr(i, 3)) <> 0 Then
- If Len(arr(i, j)) <> 0 Then
- brr(2, j - 3) = brr(2, j - 3) + 1
- If arr(i, j) >= 0 Then
- brr(3, j - 3) = brr(3, j - 3) + 1
- End If
- End If
- End If
- Next
- Next
- For j = 1 To UBound(brr, 2)
- brr(4, j) = Round(brr(3, j) / brr(2, j), 2)
- Next
- ReDim crr(1 To UBound(brr, 2))
- For j = 1 To UBound(brr, 2)
- crr(j) = Application.Index(brr, 0, j)
- Next
-
- For i = 1 To UBound(crr) - 1
- p = i
- For j = i + 1 To UBound(crr)
- If crr(p)(4, 1) < crr(j)(4, 1) Then
- p = j
- End If
- Next
- If p <> i Then
- temp = crr(i)
- crr(i) = crr(p)
- crr(p) = temp
- End If
- Next
- For j = 1 To 3
- .Cells(j + 17, 30) = crr(j)(1, 1)
- .Cells(j + 17, 31) = crr(j)(2, 1) & "战" & crr(j)(2, 1) - crr(j)(3, 1) & "负,胜率为" & crr(j)(4, 1)
- .Cells(j + 22, 24) = crr(UBound(crr) - j + 1)(1, 1)
- .Cells(j + 22, 25) = crr(UBound(crr) - j + 1)(2, 1) & "战" & crr(UBound(crr) - j + 1)(2, 1) - crr(UBound(crr) - j + 1)(3, 1) & "负,胜率为" & crr(UBound(crr) - j + 1)(4, 1)
- Next
- End With
- End Sub
复制代码 |
|