title: Highlight Google Sheet cell (red) when two different cell's text do not match
body: <p>basically what I am trying to achieve is to highlight or set background of the cell that has a 'typo' so does not match to another one.</p>
  <p>I have a tracker used by my team, they enter the code version in column D. Column C contains the environment name, e.g. QA, PROD.</p>
  <p>When QA testing activities are completed, they simply copy the code version to a row below, but what happens sometimes, they manually enter the version accidentally making a mistake (typo) - therefore the code that is implement to prod will be incorrect and can cause system malfunction.</p>
  <p>Column A will be a primary key let's call it this way (module)</p>
  <p>I am trying to validate the text they enter in the cell so I either want to use conditional formatting or a script. Conditional formatting in my opinion will not work properly as the function is quite advance, so it will be easier to implement a script. Is the below script correct?</p>
  <pre><code>  var ss = SpreadsheetApp.getActiveSpreadsheet();
    var range = ss.getSheetByName(&quot;2022&quot;).getRange(1,1);
    var cellRange = range.getValues();
  
    for(i = 0; i&lt;cellRange.length-1; i++){
       if(cellRange[i][0] == &quot;PROD&quot;)
       elseif(cellRange[i][0] == &quot;QA&quot;)
       {
         ss.getSheetByName(&quot;2022&quot;).getRange(i+2,6).setBackground(&quot;red&quot;);
       }
    }
  }
  </code></pre>
  <p>In case I use conditional formatting it would have to be: if environment equals to PROD and QA, and if QA &amp; PROD module is the same, CODE version should match... if does not match, highlight a prod code cell with red color....</p>