|
- Sub qss()
- With Sheet1
- arr = .Range("e1").CurrentRegion.Value
- ReDim Brr(1 To UBound(arr), 1 To 3)
- For i = 2 To UBound(arr)
- ma = Application.Max(Application.Index(arr, i, 0))
- mi = Application.Min(Application.Index(arr, i, 0))
- x = 0
- For j = 2 To UBound(arr, 2)
- If arr(i, j) > 0 Then
- x = x + 1
- End If
- Next
- If x = 3 Then
- For j = 2 To UBound(arr, 2)
- If arr(i, j) > 0 Then
- Brr(i, 2) = Brr(i, 2) & arr(1, j)
- End If
- Next
- Brr(i, 2) = Brr(i, 2) & ma & "人"
- Else
- t = "": t2 = "": t3 = ""
- For j = 2 To UBound(arr, 2)
- If arr(i, j) > 0 Then
- If arr(i, j) = ma Then
- t = t & arr(1, j)
-
- ElseIf arr(i, j) = mi Then
- t2 = t2 & arr(1, j)
- Else
- t3 = t3 & arr(1, j)
- End If
- End If
- Next
- Brr(i, 2) = t & t3 & ma - mi & "人," & t & t2 & mi & "人"
- End If
- Brr(i, 1) = Val(arr(i, 1))
- Brr(i, 2) = Brr(i, 1) & "." & Brr(i, 2)
- Brr(i, 3) = ma
- Next
- Brr(1, 1) = "班级": Brr(1, 2) = "组合认识": Brr(1, 3) = "班人数"
- .Range("a1").Resize(UBound(Brr), 3) = Brr
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|