In my else statement below, if a cell in column G is blank I want to clear the contents (the timestamp) of another cell in column F using the event function onEdit(). However, after testing the code and deleting values, the cell is no longer recognized as blank when comparing e.value to a blank cell using e.value == "". What can I use in the conditional that determines if a cell is truly blank after having deleted a previous value from the cell?

function onEdit(e) 
  var ss = e.source.getActiveSheet();
  var row = e.range.getRow(); //row the user has edited
  var rowHeader = 1;
  var colStart = 7 //Column that contains Departure outcome values
  var colToUpdate = 6; //Check out timestamp column to update if user edits a cell in Departure column

  if(e.range.rowStart > rowHeader && e.range.columnStart === colStart && (e.value !="" || !0))
    ss.getRange(row,colToUpdate).setValue(new Date()); // place time stamp in Check Out column
  else if(e.range.rowStart > rowHeader && e.range.columnStart === colStart && e.value == "")

Link to spreadsheet: https://docs.google.com/spreadsheets/d/11vTNBa-YVjyACKPjWDO97Zs397mJrNHnXPDnpGDoVGQ/edit?usp=sharing

1 Answer 1


The value property of the edit event object only is included when:

  1. A single cell is edited
  2. The value of the edited edited cell after it's edited is not blank.

Considering the above e.value == "" always will be false for blank cells because e.value returns undefined.

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.