|
用VBA做的公式,可直接调用。- Function jf(rng As Range)
- kc = Application.WorksheetFunction.Count(rng) '课次
- ks = Application.WorksheetFunction.Sum(rng) '课时
- arr = [{0,0;20,5;30,10;40,15;50,20;60,35}] '课时换积分规则
- jf = Application.WorksheetFunction.VLookup(ks, arr, 2)
- brr = rng
- If ks > 60 Then
- For j = 1 To UBound(brr, 2) '找到60课时的点
- xks = xks + brr(1, j)
- If xks >= 60 Then Exit For
- Next
- If j < UBound(brr, 2) Then '计算60课时后的课次
- For k = j + 1 To UBound(brr, 2)
- If brr(1, k) > 0 Then xkc = xkc + 1
- Next
- End If
- End If
- jf = jf + kc * 3 + xkc * 2
- End Function
复制代码 |
|