Main Content

xirr

Internal rate of return for nonperiodic cash flow

Description

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

example

Return = xirr(___,Guess,MaxIterations,Basis) adds optional arguments.

example

Examples

collapse all

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 12-Jan-2007

2500 14-Feb-2008

2000 03-Mar-2008

3000 14-Jun-2008

4000 01-Dec-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)
Return = 
0.1006

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)
Return = 
0.1006

Input Arguments

collapse all

Cash flow, specified as a vector or matrix. The first entry is the initial investment. 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, usually entered as a negative number.

Data Types: double

Cash flow dates, specified as a vector or matrix using a datetime array, string array, or date character vectors. 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.

To support existing code, xirr also accepts serial date numbers as inputs, but they are not recommended.

Data Types: char | datetime | string

(Optional) Initial estimate of the internal rate of return, specified as a scalar or vector. If Guess is a scalar, then it is applied to all streams, and if Guess is a vector, then it is the same length as the number of streams.

Data Types: double

(Optional) Number of iterations used by Newton's method to solve the internal rate of return, specified as a scalar or vector of positive integers. If MaxIterations is a scalar, then it is applied to all streams, and if MaxIterations is a vector, then it is the same length as the number of streams.

Data Types: double

(Optional) Day-count basis, specified as a positive integer using scalar or a N-by-1 vector. If Basis is a scalar, then it is applied to all streams, and if Basis is a vector, then it is the same length as the number of streams.

  • 0 = actual/actual

  • 1 = 30/360 (SIA)

  • 2 = actual/360

  • 3 = actual/365

  • 4 = 30/360 (PSA)

  • 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.

Data Types: double

Output Arguments

collapse all

Annualized internal rate of return of each cash flow stream, returned as a vector. A NaN indicates that a solution was not found.

References

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

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

Version History

Introduced before R2006a

expand all