1 min readDec 26, 2018
Hey Sinan!
You should find some help in the answer from Carlos Gil here:
var row = sheet.getLastRow();
var cell = sheet.getRange(row, 8);
cell.setFormulaR1C1(‘=IF(INDIRECT(“R[0]C[-6]”,0)<>””,INDIRECT(“R[0]C[-6]”,0)-INDIRECT(“R[-1]C[-6]”,0),””)’)
That should eliminate the need for the separate formula. You’ll need to adjust it to fit your particular sheet, but this should do it :).