IRR

function IRR(arg1: ApiRange = null, arg2: number = null): number | string | boolean

Description

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

Parameters

arg1ApiRangedefault: null

Is an array or a reference to cells that contain numbers for which you want to calculate the internal rate of return.

arg2numberdefault: null

Is a number that you guess is close to the result of IRR; 0.1 (10 percent) if omitted.

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"];

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

var oRange = oWorksheet.GetRange("A2:A5");
oWorksheet.GetRange("B5").SetValue(oFunction.IRR(oRange));

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