# xirr

Internal rate of return for nonperiodic cash flow

## Syntax

```Return = xirr(CashFlow, CashFlowDates) Return = xirr(CashFlow, CashFlowDates, Guess, MaxIterations,Basis) ```

## Description

`Return = xirr(CashFlow, CashFlowDates)` returns the internal rate of return for a schedule of nonperiodic cash flows.

`Return = xirr(CashFlow, CashFlowDates, Guess, MaxIterations,Basis)` returns the internal rate of return for a schedule of nonperiodic cash flows with optional inputs.

## Input Arguments

 `CashFlow` A vector or matrix of cash flows. If `CashFlow` is a matrix, each column represents a separate stream of cash flows whose internal rate of return is calculated. The first cash flow of each stream is the initial investment, entered as a negative number. `CashFlowDates` (Required) `CashFlowDates` is specified as serial date numbers, date character vectors, or datetime arrays. The size of the input date numbers for `CashFlowDates` must the same size as `CashFlow`, Each column of `CashFlowDate` represents the dates of the corresponding column of `CashFlow`. `Guess` The initial estimate of the internal rate of return. `Guess` is a scalar applied to all streams, or a vector the same length as the number of streams. Default: `0.1` (10%) `MaxIterations` The positive integer number of iterations used by Newton's method to solve the internal rate of return. `MaxIterations` is a scalar applied to all streams, or a vector the same length as the number of streams. Default: `50` `Basis` Day-count basis of the instrument. A vector of integers. 0 = actual/actual (default)1 = 30/360 (SIA)2 = actual/3603 = actual/3654 = 30/360 (BMA)5 = 30/360 (ISDA)6 = 30/360 (European)7 = actual/365 (Japanese)8 = actual/actual (ICMA)9 = actual/360 (ICMA)10 = actual/365 (ICMA)11 = 30/360E (ICMA) 12 = actual/365 (ISDA)13 = BUS/252 For more information, see Basis. Default: `0`

## Output Arguments

 `Return` Vector of the annualized internal rate of return of each cash flow stream. A `NaN` indicates that a solution is not found.

## Examples

Find the internal rate of return for an investment of \$10,000 that returns the following nonperiodic cash flow. The original investment is the first cash flow and is a negative number.

Cash Flow

Dates

(\$10000)

January 12, 2007

\$2500

February 14, 2008

\$2000

March 3, 2008

\$3000

June 14, 2008

\$4000

December 1, 2008

Calculate the internal rate of return for this nonperiodic cash flow:

```CashFlow = [-10000, 2500, 2000, 3000, 4000]; CashFlowDates = ['01/12/2007' '02/14/2008' '03/03/2008' '06/14/2008' '12/01/2008']; Return = xirr(CashFlow, CashFlowDates) ```

This returns:

```Return = 0.1006 (or 10.0644% per annum)```

Alternatively, you can use `datetime` input to calculate the internal rate of return for this nonperiodic cash flow:

```CashFlow = [-10000, 2500, 2000, 3000, 4000]; CashFlowDates = ['01/12/2007' '02/14/2008' '03/03/2008' '06/14/2008' '12/01/2008']; CashFlowDates = datetime(CashFlowDates,'Locale','en_US')'; Return = xirr(CashFlow, CashFlowDates) ```

This returns:

```Return = 0.1006 (or 10.0644% per annum)```

## References

Brealey and Myers. Principles of Corporate Finance. McGraw-Hill Higher Education, Chapter 5, 2003.

Sharpe, William F., and Gordon J. Alexander. Investments. Englewood Cliffs, NJ: Prentice-Hall. 4th ed., 1990.