NPV Function Example

This example returns the net present value for a series of cash flows contained in the array Values().  RetRate represents the fixed internal rate of return.

Static Values(5) As Double          ' Set up array.
Fmt = "###,##0.00"                  ' Define money format.
Guess = .1                          ' Guess starts at 10%.
RetRate = .0625                     ' Set fixed internal rate.
Values(0) = -70000                  ' Business start-up costs.
' Positive cash flows reflecting income for four successive years.
Values(1) = 22000 : Values(2) = 25000
Values(3) = 28000 : Values(4) = 31000
NetPVal = NPV(RetRate, Values())    ' Calculate net present value.
Msg = "The net present value of these cash flows is "
Msg = Msg & Format(NetPVal, Fmt) & "."
MsgBox Msg                          ' Display net present value.