|
参与一下。。。- Sub ykcbf() '//2023.12.30
- Dim arr, b
- Application.ScreenUpdating = False
- r = Cells(Rows.Count, 2).End(3).Row
- arr = Range("a2:x" & r)
- b = [{13,14,20,21,22,23}]
- On Error Resume Next
- For i = 1 To UBound(arr)
- n = 0: p1 = 0
- For j = 1 To UBound(b)
- If arr(i, b(j)) <> Empty Then
- n = n + 1
- If n = 1 Then
- Min = arr(i, b(j))
- Max = arr(i, b(j))
- End If
- p1 = p1 + arr(i, b(j))
- Max = IIf(Max < arr(i, b(j)), arr(i, b(j)), Max)
- Min = IIf(Min > arr(i, b(j)), arr(i, b(j)), Min)
- End If
- Next
- If Max - Min > 0.03 Then
- arr(i, 24) = "超差"
- Else
- arr(i, 24) = Round(p1 / n, 2)
- End If
- If n = 0 Then arr(i, 24) = ""
- Next
- Range("a2:x" & r) = arr
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|