title: Set date when a cell has specific text
body: <p>I have a script that will write the date and time to column 14 the moment a cell in column 4 has the text "Assign". The problem I'm facing now is that column 14 won't change when I don't directly put "Assign" in column 4.</p>
  
  <p>For example: I tell spreadsheets column 4 cell 4 =I4  and I have the text "Assign" in I4, column 14 won't display the current date time.</p>
  
  <p>The moment I manually make column 4 cell 4 "Assign" Column 14 will display the date time.</p>
  
  <p>The script works onEdit, may this be the problem? I am new to Google Apps Script.</p>
  
  <pre><code>function onEdit(e) {
    var sh =  e.source.getActiveSheet();
    var col = e.range.getColumn();
    var val = e.range.getValue();
  
    //check if sheet is 'Blad1', column edited is 'C' &amp; value is 'assign'
    if (sh.getSheetName() === 'Blad1' &amp;&amp; col === 4 &amp;&amp; val === 'Assign') {
      var row = e.range.getRow();
      var tz = e.source.getSpreadsheetTimeZone();
      var date = Utilities.formatDate(new Date(), tz, 'dd-MM-yyyy     hh:mm:ss');
  
      //set date in column 14 for same row
      sh.getRange(row, 14).setValue(date);
  
    }
  }
  </code></pre>
  
  <p>The script only works when I directly put the text in column 4. I want the script to work whenever a cell in column 4 changes to "Assign".</p>
  
  <p>P.S. Spreadsheet will get new data from a program called app sheet. When app sheet changes column 4 to "Assign" I need to show current time.</p>