I am a total newbie here trying to make my spreadsheet AUTOMATICALLY sort the data based on DATE. I've attached a photo of the spreadsheet I am using.
You'll notice a WORKDAY formula in column G. Once I've updated the Dispensed Date, the Re-order Date updates according to the formula (based on the Working Day arranged). I then use SORT RANGE A-Z for column G to first give me the earliest date. I would desperately like to automate the SORTING RANGE bit so that once I've updated the Date Dispensed, the Re-Order Date is updated according to the formula and then automatically drops the entire row to the bottom of the list.
Where I am at the moment:
I've made the column Auto Sort using YouTube, but ONLY if I change the Re-Order date myself. It is not accepting sorting the date if I update Date Dispensed. Although it does update the Re-order date to the new date, it does not sort the data A-Z. It stays where it is. I hope I'm making some sense.
This is the code/formula I've used based on YouTube:
function autoSort(e) { const row = e.range.getRow() const column = e.range.getColumn() const ss = e.source const currentSheet = ss.getActiveSheet() const currentSheetName = currentSheet.getSheetName() if(!(currentSheetName === "ORDERPAD" && column === 7 && row >= 2)) return const range = currentSheet.getRange(2,1,currentSheet.getLastRow()-1,7) range.sort({column: 7, ascending: true})}function onEdit(e){ autoSort(e)}
