LARGE
function LARGE(arg1: ApiRange | number[] = null, arg2: number = null): number
Description
Returns the k-th largest value in a data set. For example, the fifth largest number.
Parameters
The array or range of data for which the k-th largest value will be determined.
- arg2
number
null The position (from the largest) in the array or cell range of data to return.
Returns
number
Try It
const oWorksheet = Api.GetActiveSheet();
let numbersArr = [4, 13, 27, 56, 46, 79, 22, 12];
// Place the numbers in cells
for (let i = 0; i < numbersArr.length; i++) {
oWorksheet.GetRange("A" + (i + 1)).SetValue(numbersArr[i]);
}
let oFunction = Api.GetWorksheetFunction();
let oRange = oWorksheet.GetRange("A1:A8");
let largePostion = 4;
let kLargest = oFunction.LARGE(oRange, largePostion);
oWorksheet.GetRange("C1").SetValue(kLargest);