Skip to main content

IRR

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

Syntax​

expression.IRR(arg1, arg2);

expression - A variable that represents an ApiWorksheetFunction class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
arg1Requirednumber[] | ApiRangeA range or array of cells that contain numbers for which the internal rate of return will be calculated.
arg2OptionalApiRange | ApiName | numberAn estimate at what the internal rate of return will be. If it is omitted, the function will assume guess to be 0.1 (10 percent).

Returns​

number

Example​

Calculate the internal rate of return for cash flows in a spreadsheet.

// How do I find the rate of return on a series of investments in a spreadsheet?

// Determine the yield from a sequence of cash flows in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
let values = ["Values", "-$40,000.00", "$10,000.00", "$15,000.00", "$20,000.00"];

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

let range = worksheet.GetRange("A2:A5");
worksheet.GetRange("B5").SetValue(func.IRR(range));