title: Google App Script for spreadsheet
body: <p>I need to put a background color to the range cells depending the value of other cell, but this range have a diferents values, for example:</p>
  
  <p>1 X 2 1 X X | 2</p>
  
  <p>The range cells must be independent colors when check the las cell that have value 2, namely, only the cell three must have a green background color because is the same value that the and the others in a red color.</p>
  
  <p>I have this code:</p>
  
  <pre><code>function test() {
    var libro = SpreadsheetApp.getActiveSpreadsheet();
    var range_input = libro.getRange("B3:E3");
    var target_cell = libro.getRange("G3");
  
    if (range_input.getValues()==target_cell.getValue()) 
    {
      range_input.setBackgroundColor('#58FA58');    
    }
  
    else
    {
      range_input.setBackgroundColor('#FA5858')
    }  
  } 
  </code></pre>
  
  <p>But the problem is that not work because the row only is green when all values cells have the same value that the last cell, this means that the entire row become red although the cell three have the correct value.</p>
  
  <p>Thx in advance.</p>