Answer the question
In order to leave comments, you need to log in
How to calculate the sum of a range of cells of only a certain style in Google spreadsheets?
How to calculate the sum of a range of cells in Google spreadsheets, only of a certain style, for example, red or italic?
Answer the question
In order to leave comments, you need to log in
scripts can get any cell formatting.
a function written in a script, then used as a regular function in a table.
some minimal example below.
function summRedColor() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var range = sheet.getRange("H4:H6");
var bgColors = range.getBackgrounds();
var values = range.getValues();
var allRedColorRangeValues = [];
for (var i in bgColors) {
if(bgColors[i] == "#ff0000"){
allRedColorRangeValues.push(values[i]);
Logger.log("красный цвет");
}
else{
Logger.log("другой цвет");
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question