title: Very strange Google Apps Script behavior
body: <p>I am seeing some very strange behavior with Google Apps Script. All I am trying to do is parse some rows in my sheet and if for any row, if the date is > 1/1/1999 then add a dropdown which pre populates some Error Value. The strange behavior here is that this always populates the dropdown one row above the row which satisfies the date check condition. So for example if row #5 satisfies the condition, the dropdown is populated in row #4. Not sure why this is happening. I also tried to do this</p>
  
  <pre><code>var range = sheet.getRange(i+1, 14);
  </code></pre>
  
  <p>but that doesn't seem to show anything on the screen. I am unable to understand this strange behavior. Any help will be appreciated. </p>
  
  <pre><code>var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[1];
  
  var dataRange = sheet.getDataRange();
  var values = dataRange.getDisplayValues();
  
  for (var i = rowNum; i &lt; values.length; i++) {
  
  if (new Date(values[i][9]).getTime() &gt; new Date('1/1/1999').getTime()){
    SpreadsheetApp.getUi().alert(values[i][2]);
  
    var range = sheet.getRange(i, 14);
    var rule = SpreadsheetApp.newDataValidation().requireValueInList(['Error Value'], true).build();
    range.setDataValidation(rule);
  }
  </code></pre>