Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Financial Class
Financial Methods
 IRR Method

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Financial..::.IRR Method

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

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Visual Basic (Declaration)
Public Shared Function IRR ( _
    ByRef ValueArray As Double(), _
    Guess As Double _
) As Double
Visual Basic (Usage)
Dim ValueArray As Double()
Dim Guess As Double
Dim returnValue As Double

returnValue = Financial.IRR(ValueArray, _
    Guess)
C#
public static double IRR(
    ref double[] ValueArray,
    double Guess
)
Visual C++
public:
static double IRR(
    array<double>^% ValueArray, 
    double Guess
)
JScript
public static function IRR(
    ValueArray : double[], 
    Guess : double
) : double

Parameters

ValueArray
Type: array<System..::.Double>[]()[]%
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
Type: System..::.Double
Optional. Object specifying value you estimate will be returned by IRR. If omitted, Guess is 0.1 (10 percent).

Return Value

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

For more detailed information, see the Visual Basic topic IRR Function.

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 does not 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 cannot find a result after 20 tries, it fails.

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

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

Dim values(4) As Double
' Business start-up costs.
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.")

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
An alternative implementation of IRR in C#      Mai Kalange   |   Edit   |   Show History

I found this working sample for the calculation of IRR. It uses the Newton-Rapshon method of finding real zeros of a function.

http://code.google.com/p/irr-newtonraphson-calculator/downloads/list

IRR function is throwing exception      adremtec   |   Edit   |   Show History
When I am try to increase the array size more than 5 and passing the cash flow values to IRR function, it is throwing an exception.

example
Dim values(6) AsDouble
' Business start-up costs.
values(0) = -70000
' Positive cash flows reflecting income for four successive years.
values(1) = 22000
values(2) = 25000
values(3) = 28000
values(4) = 31000
values(5) = 33000

And passing this array to IRR function throws exception. Is this known bug?
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker