So I have sheet that has data in Row X of Column C and D, so two cells worth of data. I'm going to store data from Row X into a variable to hold it. I then want to use the data, a numeric value from Row X Column C to find a matching value on another sheet called DataBase located somewhere in Column J. Once if find that number i want to take the data in the adjacent cell , Column K and store that in a variable. Then i need to compare those variables to see if they match if they dont change the color of the invalid data from sheet1 Column D and move onto the next Row of Column C and continue the process till im done.
function goodDataCheck() {
var sheet = SpreadsheetApp.getActive();
var bpNum = sheet.getDataRange().getValues();
for(var i = 0; i < bpNum.length-1;i++)
{
var matcher = sheet.getSheetByName("Database").getDataRange(i + 1, 9).getValues(); // get value in cell i + 1 column 9 or "j"
if(bpNum[i][2] == matcher[i][9])
{
var alleleRow = i;
var currentAllel = sheet.getRange(alleleRow + 1, 9); // get value of
current cell
if (currentAllel == matcher)
{
sheet.getRange(i, 3).setBackground('green')
} else
{
sheet.getRange(i, 3).setBackground('yellow')
}
}
}
}
i get following error Cannot find method getDataRange(number,number). (line 10, file "AllelGoodData
getDataRange(i + 1, 9)ofsheet.getSheetByName("Database").getDataRange(i + 1, 9).getValues().getDataRange()doesn't use the arguments. If you want to get the range, how about usinggetRange(i + 1, 9)? I think that by this modification, the error message is removed or changed. This was not the direct solution, I apologize. - Tanaike