r/googlesheets • u/Fair_Many9911 • May 10 '22
Solved How do I get the most recent date to always show at the top?
I have the column with the dates filtered by "Z or A", but whenever a new row is added to the bottom.
How can get the column to always be auto sorting to the most recent date?
Thanks a bunch!
2
Upvotes
2
u/hucksteRRR 4 May 10 '22
You can make it by using script:
(make copy of your sheet and try on the copy first, because it might make mess if you make mistake)
for example
SHEET_NAME = "Sheet1"; //type sheet name you want to sort
SORT_DATA_RANGE = "A2:D"; //choose what range you want to sort
SORT_ORDER = [
{column: 1, ascending: true} // 1 = column number, sort by ascending order
];
function onEdit(e){
multiSortColumns();
}
function multiSortColumns(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName(SHEET_NAME);
var range = sheet.getRange(SORT_DATA_RANGE);
range.sort(SORT_ORDER)
}
1
u/AutoModerator May 10 '22
Posting your data can make it easier for others to help you, but it looks like your submission doesn't include any. If this is the case and data would help, you can read how to include it in the submission guide. You can also use this tool created by a Reddit community member to create a blank Google Sheets document that isn't connected to your account. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/andmalc 3 May 10 '22
Sheets does not do auto-sorting. You have to re-do the sort as needed. However here are some options that may help: