This is the current script. When a cell in column 26 is edited, a datestamp is added to the cell beside it in column 27. Now I would like to add additional criteria. Example: When col 26 value is "Text" then col 27 date stamp.

Can anyone help me plz.

function onEdit(e)

function addTimestamp(e)
  var startRow = 3;
  var targetColumn = 26;
  var ws = "START";
  var currentDate = new Date();
  var row = e.range.getRow();
  var col = e.range.getColumn();
  if(col === 26 && row >= startRow && e.source.getActiveSheet().getName() === ws)
    e.source.getActiveSheet().getRange(row,27).setValue(new Date());

1 Answer 1


You're already using Event Objects.

  • One of the available objects is "value" (New cell value after the edit. Only available if the edited range is a single cell).

Your IF statement already has three (3) criteria, so just add another. Something like:

if(col === 26 && row >= startRow && e.source.getActiveSheet().getName() === ws && e.value === "Text"){

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.