我很难解释这个。以下函数用作工作表公式。“空”值仅表示单元格为空,因此没有值。给定值 {empty, empty, 0.8, 0.2},以下函数有时会返回值,例如 5.55111512312578E-17。在调试器中,看起来一切都是正确的,直到 ParamArray 中的最后一个值(在本例中为 0.2)被处理。有什么想法吗?
Private Function getOvertimeEP(ParamArray epAllocations() As Variant)
Dim overtimeEP As Double
overtimeEP = -1
For Each nextVal In epAllocations
overtimeEP = overtimeEP + nextVal
Next
If overtimeEP < 0 Then
overtimeEP = 0
End If
getOvertimeEP = overtimeEP
End Function