【发布时间】:2020-10-15 19:34:56
【问题描述】:
Sub npv()
Dim val As Long
Dim dr As Long
Dim inv As Long
Dim answer As Long
Dim i As Long
dr = Cells(1, 5).Value 'Cells(Row, Column)
inv = Cells(2, 5).Value
val = Cells(1, 1).Value
i = 0
ReDim cashFlow(1 To val) As Long
Do While i < val
i = i + 1
cashFlow(i) = Cells((i + 1), 1)
Loop
i = 0
Do While i < val
i = i + 1
answer = answer + cashFlow(i) / ((1 + dr) ^ i)
Loop
answer = answer - inv
Cells(4, 5).Value = answer
End Sub
您好,我想弄清楚为什么这不会输出正确的 NPV。初始投资为 500,贴现率为 0.17,现金流为 50、150、175、225,它输出的答案为 100.00。它应该是-118.35。我知道 excel 有这方面的公式,但需要手动完成。
【问题讨论】: