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

## 定义

``public static double IRR (ref double[] ValueArray, double Guess = 0.1);``
``static member IRR : Double[] * double -> double``
``Public Function IRR (ByRef ValueArray As Double(), Optional Guess As Double = 0.1) As Double``

ValueArray
Double[]

Guess
Double

Double

## 示例

``````' 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 IRR function to calculate the rate of return.
' Guess starts at 10 percent.
Dim Guess As Double = 0.1
' Calculate internal rate.
Dim CalcRetRate As Double = IRR(values, Guess) * 100
' Display internal return rate.
MsgBox("The internal rate of return for these cash flows is " &
Format(CalcRetRate, CStr(PercentFmt)) & " percent.")
``````

## 注解

`IRR` 函数使用数组中的值顺序来解释付款和收据的顺序。 请务必按正确的顺序输入付款和收据值。 每个周期的现金流不需要固定，因为它用于年金。

`IRR` 由迭代计算。 从值 `Guess`开始， `IRR` 将循环计算，直到结果准确到 0.00001% 以内。 如果在 `IRR` 20 次尝试后找不到结果，则失败。