XIRR

function XIRR(arg1: any = null, arg2: any = null, arg3: any = null): number | string | boolean

Description

Returns the internal rate of return for a schedule of cash flows.

Parameters

arg1anydefault: null

Is a series of cash flows that correspond to a schedule of payments in dates.

arg2anydefault: null

Is a schedule of payment dates that corresponds to the cash flow payments.

arg3anydefault: null

Is a number that you guess is close to the result of XIRR.

Returns

number | string | boolean

Try It

var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
var values = ["Values", "-$40,000.00", "$10,000.00", "$15,000.00", "$20,000.00"];
var dates = ["Dates", "1/1/2018", "4/1/2018", "8/1/2018", "12/1/2018"];

for (var i = 0; i < values.length; i++) {
   oWorksheet.GetRange("A" + (i + 1)).SetValue(values[i]);
}
for (var j = 0; j < dates.length; j++) {
   oWorksheet.GetRange("B" + (j + 1)).SetValue(dates[j]);
}

oWorksheet.GetRange("B1").SetColumnWidth(15);
var oRange1 = oWorksheet.GetRange("A2:A5");
var oRange2 = oWorksheet.GetRange("B2:B5");
oWorksheet.GetRange("C5").SetValue(oFunction.XIRR(oRange1, oRange2));

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).