GetRank
Returns the rank value for the top 10 condition.
Syntax
expression.GetRank();
expression - A variable that represents a ApiTop10 class.
Parameters
This method doesn't have any parameters.
Returns
number
Example
Read how many top or bottom values a top 10 conditional formatting rule highlights in a spreadsheet.
// How do I find the count of values highlighted by a top 10 conditional formatting rule in a spreadsheet?
// Confirm the number of items targeted by a top or bottom highlight rule in a spreadsheet.
let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("Numbers");
worksheet.GetRange("A2").SetValue(15);
worksheet.GetRange("A3").SetValue(25);
worksheet.GetRange("A4").SetValue(35);
worksheet.GetRange("A5").SetValue(45);
let range = worksheet.GetRange("A2:A5");
let formatConditions = range.GetFormatConditions();
let top10Condition = formatConditions.AddTop10();
let rank = top10Condition.GetRank();
worksheet.GetRange("B1").SetValue("Current rank: " + rank);