title: Applying a formula to all cells in a column, unless equals x
body: <p>I am trying to Apply a formula to a column but only if the cell does not contain a certain value (EMAIL SENT), I have a script that sends emails when a row has "send email" in column "AF" and replaces it with "EMAIL SENT" to avoid re-sends, I need it to skip cells with "EMAIL SENT" in them.</p>
  
  <p>Here is the script I have so far but it rewrites over cells and resets cells back to "send email".
  Thanks in advance.<br>
  A Beginner scripter.<br>
  ps or to get this formula to start at the first empty cell in column AF.</p>
  
  <pre><code>  var sss4 = SpreadsheetApp.openById('&lt;ID&gt;');
    var ss4 = sss4.getSheetByName('Results');
    ss4.getRange("AF2").setFormula('=IF(((AND(OR(I2="YOUR TRIP DWL",I2="MEGA PACK DWL (YT + AA + BONUS)"),M2&lt;=0,AA2&lt;&gt;"",AE2&lt;&gt;""))), "Send Email", "Wait")');
    var lr4 = ss4. getLastRow();
    var filldownrange4 = ss4.getRange(2, 32, lr4-1);
    ss4. getRange("AF2").copyTo(filldownrange4);
  </code></pre>