title: Google Script, for loop stops before reaching its condition causing it not to continue through the un-checked data
body: <p>I'm trying to get a value from the sheet that I'm editing and compare it with another sheets cell which holds the another value to see if it matches, everything seems to be working pretty well but once the for loop starts it only goes through about 90-100 lines before stopping, making it fail to equal the conditions set, I have it print out to an empty cell telling me what it has gone through so far as it slowly goes down the list.</p>
  
  <pre><code>var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheetMasterList = ss.getSheetByName("Master Item List");
  var sheetItems = ss.getSheetByName("Items");
  
  function onEdit(event){
  
  
    if (ss.getActiveSheet().getName() == "Master Item List"){
      var r = event.range;
      var v = event.value;
      checkColumnIfEditedI(r,v);
    }
  }
  
  function checkColumnIfEditedI(gotRange,value){
    // Get the row and column
    var columnOfEditedRange = gotRange.getColumn();
    var rowOfEditedRange = gotRange.getRow();
    var valueOfEditedRange = value;
  
  
    if (columnOfEditedRange == 1){
      var lastRowInItems = sheetItems.getLastRow();
  
      for (i=lastRowInItems; i&gt;=0; i--){
        var rowChecked = sheetItems.getRange(i, 4).getValue();
  
        if (rowChecked == valueOfEditedRange){
          sheetMasterList.getRange(2, 17).setValue("Found your row");
          break
        }else{
          sheetMasterList.getRange(2, 17).setValue("Caching: \nRow " + i + " Column 4" + "\nResult " + rowChecked);
        }
  
      }
  
  
    }else{
      sheetMasterList.getRange(30, 1).setValue("Not the correct Row");
    }
  }
  
  // Check which cell has been edited (Master Items List) DONE
  // If Master Items List was edited check what cell and row was edited DONE
  // Check if Items sheet has said item
  // If item in Items sheet does not exist set "Not in cell"
  // If item in Items sheet does exist set "In Cell" and link to the Items sheet data.
  </code></pre>
  
  <p>I do admit there is probably an easier way of doing all this code I have done but it works for me if you want to fix it up and make it useless lines I'm all eyes :D</p>