title: Add timestamp in a different sheet when cell equals a specific value with matching ID #'s
body: <p>I am using google sheets and have one sheet called Sales that stores my data for the month's sales and another sheet that pulls in inventory data with index(match) all based on the Item#. I want to mark a sold product sold with "yes" colum L. Once I select YES i would like the script to enter the sold date into the inventory sheet for the item that was sold. I feel like I am so close but I only have the timestamp going to the adjacent cell and I need it to look up the ID number and leave the timestamp in the inventory sheet for the product that sold. Note: make a copy of the sales sheet every month rename it "Sales for XXX" and then wipe the data clean in the "Sales" sheet so I need the timestamp to stick and not be removed after the data is cleared for the next month. </p>
  
  <pre><code>function onEdit(event){ 
    var s = SpreadsheetApp.getActiveSheet();
    if( s.getName() == "SALES" ) { //checks that we're on the correct sheet
    var ColL = 12;  // Column Number of "L"
    var changedRange = event.source.getActiveRange();
    if (changedRange.getColumn() == ColL) {
      // An edit has occurred in Column L
      var state = changedRange.getValue();
      var adjacent = 
  event.source.getActiveSheet().getRange(changedRange.getRow(),ColL+1);
      var timestamp = new Date(); // Get the current time
      // We'll do something different, depending on the selected value
      switch (state) {
        case "Yes":
          // Write timestamp into adjacent cell
          adjacent.setValue(timestamp);
          break;
        case "No":
          // Erase timestamp in adjacent cell
          adjacent.clearContent();
          break;
     }
    }
   }
  }
  </code></pre>