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

arg1ApiRange | number[]default: null

The array or range of data for which the k-th largest value will be determined.

arg2numberdefault: 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);

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