jeudi 1 novembre 2018

script and formula for timestamp when a check mark is filled

I saw this response (below) from a poster responding to a request for an automatic timestamp when a cell is filled out. I've added this script as a new project in Google Sheets. My question is, what is the formula to use in the cell where I want the timestamp??

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() == 4 ) { //checks the column
  var nextCell = r.offset(0, 1);
  if( nextCell.getValue() === '' ) //is empty?
    nextCell.setValue(new Date());
}
}
}

This code does what I understood from yours, which is: if something is edited on column D and column E is empty, add the current date to E.




Aucun commentaire:

Enregistrer un commentaire