# Financial.NPV(Double, Double[]) 方法

## 定义

``````public:
static double NPV(double Rate, cli::array <double> ^ % ValueArray);``````
``public static double NPV (double Rate, ref double[] ValueArray);``
``static member NPV : double * Double[] -> double``
``Public Function NPV (Rate As Double, ByRef ValueArray As Double()) As Double``

Rate
Double

ValueArray
Double[]

Double

#### 例外

`ValueArray``Nothing`，排名为 `ValueArray` <> 1，或 `Rate` = -1

## 示例

``````' Define money format.
Dim MoneyFmt As String = "###,##0.00"
' Define percentage format.
Dim PercentFmt As String = "#0.00"

Dim values(4) As Double
values(0) = -70000
' Positive cash flows reflecting income for four successive years.
values(1) = 22000
values(2) = 25000
values(3) = 28000
values(4) = 31000

' Use the NPV function to calculate the net present value.
' Set fixed internal rate.
Dim FixedRetRate As Double = 0.0625
' Calculate net present value.
Dim NetPVal As Double = NPV(FixedRetRate, values)
' Display net present value.
MsgBox("The net present value of these cash flows is " &
Format(NetPVal, MoneyFmt) & ".")
``````

## 注解

`NPV` 函数使用数组中的值顺序来解释付款和收据的顺序。 请务必按正确的顺序输入付款和收据值。

`NPV` 函数类似于 `PV` 函数 (现值) ，但 `PV` 函数允许现金流在句点的末尾或开头开始。 与可变 `NPV` 现金流值不同， `PV` 在整个投资过程中必须固定现金流。