Returns the rank of a number in a list of numbers: its size relative to other values in the list. If more than one value has the same rank, the top rank of that set of values is returned.
Name | Type | Description |
arg1 | number | The number for which the rank will be returned. |
arg2 | Array.<number> | ApiRange | An array of numbers or a reference to a list of numbers. Nonnumeric values are ignored. |
arg3 | boolean | The numeric value that specifyes how to order the numbers. If it is 0 or omitted, the rank in the list will be sorted in descending order. Any other numeric value means that the rank in the list will be sorted in ascending order. |
builder.CreateFile("xlsx"); const oWorksheet = Api.GetActiveSheet(); var valueArr = [7, 6, 5, 5]; // Place the numbers in cells for (var i = 0; i < valueArr.length; i++) { oWorksheet.GetRange("A" + (i + 1)).SetValue(valueArr[i]); } //method params var number = oWorksheet.GetRange("A3"); var range = oWorksheet.GetRange("A1:A4"); var order = 0; var oFunction = Api.GetWorksheetFunction(); var ans = oFunction.RANK_EQ(number, range, order); oWorksheet.GetRange("C1").SetValue(ans); builder.SaveFile("xlsx", "RANK_EQ.xlsx"); builder.CloseFile();