(RE-POSTING DUE TO POOR FORMATTING ON ORIGINAL THREAD)
Hey guys, I have the script below sort of working. It's posting the formula like it should if column 'K' = "PENDING" and column 'R' = "". No problems so far. The issue that I'm having is that when it posts the formulas, it posts the exact formula that's in the script. I've ran others (and mistakenly assumed that this would) where the formula starts at H2+G2 but if the criteria to match is in row 11, it would go to H11 + G11. In my case now it doesn't do that. I need it to. Any matches it finds, it puts the formula 'H2+G2' but I need the formula numbers to match the row number the function is ran in. Hopefully that makes sense.
This is what I currently have:
</data_len;>
Hey guys, I have the script below sort of working. It's posting the formula like it should if column 'K' = "PENDING" and column 'R' = "". No problems so far. The issue that I'm having is that when it posts the formulas, it posts the exact formula that's in the script. I've ran others (and mistakenly assumed that this would) where the formula starts at H2+G2 but if the criteria to match is in row 11, it would go to H11 + G11. In my case now it doesn't do that. I need it to. Any matches it finds, it puts the formula 'H2+G2' but I need the formula numbers to match the row number the function is ran in. Hopefully that makes sense.
This is what I currently have:
Code:
function fillColB() {
var s = SpreadsheetApp.getActiveSpreadsheet();
var sheet = SpreadsheetApp.getActive().getSheetByName('Locate');
var data = sheet.getDataRange().getValues();
var data_len = data.length;
for(var i=0; i<data_len; i++)="" {
<data_len; i++) {
if(data[i][17] == "") {
if(data[i][10] == "PENDING") {
var cell = sheet.getRange(i+1,12).setFormula('H2+G2');
sheet.getRange(i+1,13).setFormula('=C2+M2');
}
}
}
}
Last edited: