title: Matching values between 2 ranges continuously and pasting value in different col, if true
body: <p>I have a google sheet with 2 tabs, BOMSheet &amp; POProcess. I want to copy the PO Number from PO Process sheet by looking up the column B values of POProcess sheet (one by one continuously) in column D values of BOM Sheet and if matches then pasting the PO number in column M of the BOM sheet (for all values that are matched). here is the link of the sheet.</p>
  
  <p><a href="https://docs.google.com/spreadsheets/d/1MqYn2AjPncx-RvvyTS8Nj0ujpm9Lcd_ORJF9Wqbw6y0/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1MqYn2AjPncx-RvvyTS8Nj0ujpm9Lcd_ORJF9Wqbw6y0/edit?usp=sharing</a></p>
  
  <p>I tried the code below but it's not working as its checking up the only one value from the PO Process sheet. Please help how to iterate the values from PO process sheet</p>
  
  <p>function UpdateStatus() {</p>
  
  <pre><code>var sss = SpreadsheetApp.getActiveSpreadsheet();
  var ss = sss.getSheetByName('POProcess'); //replace with source Sheet tab name
  var range = ss.getRange('C4'); //assign the range you want to copy
  var data = range.getValues();
  
  var range2 = ss.getRange('B8'); //value to look for to be replaced
  var data2 = range2.getValues();
  
  var sheet = sss.getSheetByName('BOMSheet');
  var range3 = sheet.getRange('A:L');
  var values = range3.getValues();
  for (var i = 0; i &lt; values.length; i++) {
    if (values[i][3] == data2) {
     values[i][12] = data;
  
    }
  }
  range3.setValues(values);
  </code></pre>
  
  <p>}</p>