script and formula for timestamp when a check mark is filled

834 views Asked by At

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??

Henrique G. Abreu said: "Just to help you get started ... "automatic timestamp when a cell is filled out ...

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."

0

There are 0 answers