IRR Function
The document is archived and information here might be outdated

# IRR Function

Visual Studio .NET 2003

Returns a Double specifying the internal rate of return for a series of periodic cash flows (payments and receipts).

```Function IRR( _
ByRef ValueArray() As Double, _
Optional ByVal Guess As Double = 0.1 _
) As Double
```

#### Parameters

ValueArray()
Required. Array of Double specifying cash flow values. The array must contain at least one negative value (a payment) and one positive value (a receipt).
Guess
Optional. Object specifying value you estimate will be returned by IRR. If omitted, Guess is 0.1 (10 percent).

#### Exceptions/Errors

Exception type Error number Condition
ArgumentException 5 Array argument values are invalid.

#### Remarks

The internal rate of return is the interest rate received for an investment consisting of payments and receipts that occur at regular intervals.

The IRR function uses the order of values within the array to interpret the order of payments and receipts. Be sure to enter your payment and receipt values in the correct sequence. The cash flow for each period doesn't need to be fixed, as it is for an annuity.

IRR is calculated by iteration. Starting with the value of Guess, IRR cycles through the calculation until the result is accurate to within 0.00001 percent. If IRR can't find a result after 20 tries, it fails.

#### Example

In this example, the IRR function returns the internal rate of return for a series of 5 cash flows contained in the array `Values()`. The first array element is a negative cash flow representing business start-up costs. The remaining 4 cash flows represent positive cash flows for the subsequent 4 years. `Guess` is the estimated internal rate of return.

```Sub TestIRR()
Dim Guess, RetRate, Values(4) As Double
Dim Fmt, Msg As String
Guess = 0.1  ' Guess starts at 10 percent.
Fmt = "#0.00"   ' Define percentage format.
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
RetRate = IRR(Values, Guess) * 100   ' Calculate internal rate.
Msg = "The internal rate of return for these five cash flows is "
Msg = Msg & Format(RetRate, CStr(Fmt)) & " percent."
MsgBox(Msg)    ' Display internal return rate.
End Sub
```

#### Requirements

Namespace: Microsoft.VisualBasic

Module: Financial

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)