你试下面的函数
Public Function MyGetValue(A As Double, B As Double, C As Double, D As Double, E As Double, F As Double, H As Double, J As Double, K As Double, L As Double)
If A + B >= D Then
E = D
F = 0
H = 0
Exit Function
End If
If A + B < D And F >= C * L Then
E = A + B
F = (D - E) * J / L
H = 0
Exit Function
End If
If A + B < D And (J >= C(D - E) And J < C * L) Then
E = A + B
F = C(D - E)
H = 0
Exit Function
End If
If A + B < D And C(D - E) > J Then
E = A + B
F = J
H = C(D - E) - F
Exit Function
End If
End Function