Created
September 6, 2018 18:16
-
-
Save ruzz311/c9b1a583f3f71d6002fb181ac1ac540d to your computer and use it in GitHub Desktop.
Google Sheets Macro Function - Highlight a max/min values in a column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @OnlyCurrentDoc */ | |
function myFunction2() { | |
var spreadsheet = SpreadsheetApp.getActive(); | |
var conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules(); | |
conditionalFormatRules.push(SpreadsheetApp.newConditionalFormatRule() | |
.setRanges([spreadsheet.getActiveRange()]) | |
.whenFormulaSatisfied('=$H:$H=max(H:H)') | |
.setBackground('#B7E1CD') | |
.build()); | |
spreadsheet.getActiveSheet().setConditionalFormatRules(conditionalFormatRules); | |
conditionalFormatRules = spreadsheet.getActiveSheet().getConditionalFormatRules(); | |
conditionalFormatRules.push(SpreadsheetApp.newConditionalFormatRule() | |
.setRanges([spreadsheet.getActiveRange()]) | |
.whenFormulaSatisfied('=$H:$H=min(H:H)') | |
.setBackground('#F4C7C3') | |
.build()); | |
spreadsheet.getActiveSheet().setConditionalFormatRules(conditionalFormatRules); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment