I currently have a column, e.g. ColB, containing SUMIF functions with its data range from other sheets and a column, e.g. ColC, with dates that I want to automatically update to the last date ColB's value were changed. Here's a picture to illustrate what I mean:
From searching around, I found the following Google Apps Scripts but they only seem to work if the change to ColB's cells is a direct edit as opposed to its value changing from the SUMIF function recalculating new data:
Example Script 1:
function onEdit(e) {
if ([2, 5, 8, 11].indexOf(e.range.columnStart) != -1) {
e.range.offset(0, 1).setValue(new Date());
}
}
Example Script 2:
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Sheet1" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 13 ) { //checks the column
var nextCell = r.offset(0, 1);
if( nextCell.getValue() === '' ) //is empty?
var time = new Date();
time = Utilities.formatDate(time, "GMT", "HH:mm:ss");
nextCell.setValue(time);
};
};
}
Is there a Google Apps script that can execute what I want?