GetTopBottom
Returns the "XlTopBottom" constant indicating whether the ranking is evaluated from the top or bottom.
Syntax
expression.GetTopBottom();
expression - A variable that represents a ApiTop10 class.
Parameters
This method doesn't have any parameters.
Returns
Example
Read whether a top 10 rule highlights the highest or lowest values in a spreadsheet.
// How do I check if a top 10 conditional formatting rule targets top or bottom values in a spreadsheet?
// Confirm the direction of a top 10 highlight rule — highest or lowest — in a spreadsheet.
let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("Test Scores");
worksheet.GetRange("A2").SetValue(88);
worksheet.GetRange("A3").SetValue(76);
worksheet.GetRange("A4").SetValue(94);
worksheet.GetRange("A5").SetValue(82);
let range = worksheet.GetRange("A2:A5");
let formatConditions = range.GetFormatConditions();
let top10Condition = formatConditions.AddTop10();
let topBottom = top10Condition.GetTopBottom();
worksheet.GetRange("B1").SetValue("Direction: " + topBottom);