Answer the question
In order to leave comments, you need to log in
How to change value depending on cell color?
Such question: it is necessary for me that at change of color in one cell, other cell is automatically filled. For example, if we change the color of cell A1 to green, then "yes" was written in cell B1, and if it is red, then "no"
Answer the question
In order to leave comments, you need to log in
You can do this https://docs.google.com/spreadsheets/d/1hl1zEArivM...
/**
* @customfunction
*/
function COLORED(range) {
const book = SpreadsheetApp.getActiveSpreadsheet();
const formula = book.getActiveRange().getFormula();
const [skip, addr] = formula.match(/\((.*)\)/) || [undefined, undefined];
if(addr){
const range = (/!/.test(addr) ? book : book.getActiveSheet()).getRange(addr);
return range.getBackgrounds().map(row => row.map(cell => {
let res = ''
switch(cell){
case '#4285f4': res = 'Да';
break;
case '#ea4335': res = 'Нет';
break;
default:
break;
}
return res;
}));
}
return '-';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question