Calculates the internal rate of return for a schedule of cash flows that is
not necessarily periodic. To calculate the internal rate of return for a
series of periodic cash flows, use the calculateInternalRateOfReturn()
function.
Remarks:
cashFlows and dates must be arrays of equal length, with at least 2
entries.
cashFlows must contain at least one positive and one negative cash flow.
All values in dates must be valid Date objects, and no date may precede
the first date in the array.
In most cases you do not need to provide guess for the calculation. If
omitted, guess defaults to 0.1 (10 percent).
guess must be greater than -1.
calculateDatedInternalRateOfReturn() is closely related to
calculateDatedNetPresentValue(), the net present value function. The rate
of return calculated by calculateDatedInternalRateOfReturn() is the
interest rate corresponding to XNPV = 0.
Uses an iterative technique for calculating XIRR. Using a changing rate
(starting with guess), this function cycles through the calculation until
the result is accurate within a small absolute threshold. If this function
can't find a result that works after 200 tries, a RangeError is thrown.
Parameters
options: DatedInternalRateOfReturnOptions
The dated internal rate
of return calculation options.
Returns number
The internal rate of return.
Throws
When inputs are invalid or the algorithm cannot
converge.
Calculates the internal rate of return for a schedule of cash flows that is not necessarily periodic. To calculate the internal rate of return for a series of periodic cash flows, use the
calculateInternalRateOfReturn()function.Remarks:
cashFlowsanddatesmust be arrays of equal length, with at least 2 entries.cashFlowsmust contain at least one positive and one negative cash flow.datesmust be validDateobjects, and no date may precede the first date in the array.guessfor the calculation. If omitted,guessdefaults to0.1(10 percent).guessmust be greater than-1.calculateDatedInternalRateOfReturn()is closely related tocalculateDatedNetPresentValue(), the net present value function. The rate of return calculated bycalculateDatedInternalRateOfReturn()is the interest rate corresponding to XNPV = 0.