hope I can explain this succinctly. It's a doozy of a problem for someone with my low understanding of Sheets and scripts.
So I have a sheet using this script once a day:
function recordHistory() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("History");
var source = sheet.getRange("A2:C2");
var values = source.getValues();
values[0][0] = new Date();
sheet.appendRow(values[0]);
var cells = sheet.getRange("A2:A980");
cells.setNumberFormat("dd/MM/yyyy");
};
It grabs data from another sheet and appends it to columns A, B, C (Date, amount, %). Columns D-G contain formulas tracking absolute and % changes in B & C over time. At present every day I go and manually copy down those formulas, but there must be a way to automate that? Presumably possible methods include the following:
1) add something to the script to copy down the formula from the previous day. This guy has written something that may help, but I know so little about coding I can't even understand how to integrate this into my present script: http://googlescripts.harryonline.net/copy-formulas-down
2) edit the script to append to Columns A-C, ignoring any content in other columns. Then I could fill down the formulas in D-G (using IF(isblank...)) and leave them there. However if I do that now, the script appends new data in a new row at the very bottom, after all the content in columns D-G.
3) edit the script and use an array formula? I finally worked out an array formula that works on its own terms. But sadly the script still functions just like in problem 2 above. i.e. it appends new data in a new row at the very bottom of the spreadsheet, perceiving all existing rows to be filled by the array formulas, even when what they're returning is blank cells.
Any ideas on how to make any of the above a reality, or any completely different solutions, all massively appreciated! Cheers