Sample of the page I am using
I use a conditional format across my sheets but want to change it to Google Script instead.
For every check out date that does not have a Y, highlight yellow.
I managed to modify a script to highlight a cell based on two conditions for A:D but cannot figure out how to extend it to the other ranges in my sheet.
Here is what I have so far that I found :
function onEdit(e) {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("A:D");
var values = range.getValues();
//for each row that data is present
for(var i = 0; i < values.length; i++) {
var cell = sheet.getRange(i + 1, 4);
if(values[i][1] !== "") {
if(values[i][3] === "") {
cell.setBackground('yellow');
} else {
cell.setBackground(null);
}
} else {
cell.setBackground(null);
}
}
}
Links: Google App Script - Conditional Formatting Based on Another Cell
Try this:
I tested this a little and it seems to work
Try this for the entire spreadsheet:
Keep in mind if you have multiple people editing the sheet then you are going to be missing some edits because the script will not be able to keep up.