'不封顶本身就有问题,根本没有实用价值,稍作修改。
Option Explicit
Sub test()
Dim i, arr, brr, j, pos
arr = Range("f1:iv" & Cells(Rows.Count, "f").End(xlUp).Row)
brr = [a1].CurrentRegion
arr(1, 2) = 10 ^ 4: arr(2, 2) = 0.2
For i = 3 To UBound(arr, 2): arr(1, i) = arr(1, 2) * (i - 1): Next
For i = 3 To UBound(arr, 2): arr(2, i) = arr(2, i - 1) + 0.02: Next
For j = 2 To UBound(arr, 2)
For i = 3 To UBound(arr, 1)
arr(i, j) = arr(i - 1, j) + 0.02
Next i, j
For i = 2 To UBound(brr, 1)
For j = 2 To UBound(arr, 1)
If InStr(brr(i, 2), arr(j, 1)) Then pos = j: Exit For '"置业顾问"应该为"顾问"?只能用instr匹配来
Next
If j < UBound(arr, 1) + 1 Then
If brr(i, 3) < arr(1, 2) Then
brr(i, 1) = 0
Else
For j = 3 To UBound(arr, 2)
If brr(i, 3) < arr(1, j) Then brr(i, 1) = brr(i, 3) * arr(pos, j - 1): Exit For
Next
If j = UBound(arr, 2) + 1 Then brr(i, 1) = "级别太高无法匹配!"
End If
Else
brr(i, 1) = "无此级别!"
End If
Next
With [d1]
.Resize(UBound(brr, 1)) = brr
.Value = "提成"
End With
End Sub |