Thank you for spoon feeding this to me! I found a few other videos that explained what you was explaining however, i was struggling to wrap my head around it. Very helpful video.
Hi! amazing tutorials. Thanks. Can I ask if there's a way to have automatic arrangement? I have a CountA formula in my column B so that whenever I add new info on different sheets, it will show up in the summary or scoreboard. I noticed it doesn't automatically rearrange to descending or ascending unless I type a new number then it will arrange itself just like in your tutorial. Hope I explained my question clearly. Thank you so much. 🙏
This works perfectly! Thank you Chester. How do I modify the script to make the auto sort work in multiple tables in the same sheet and in multiple sheets of the same google sheets file? It would be very helpful as a lot of people would require this to work in multiple tables of the same sheet and other sheets in the same file.. Please help :)
I can't seem to get it to sort when the sort column is formula... If I re copy the formula down the column the sort kicks in (I assume it's detecting that as the edit event rather than the formula simply updating based on edits elsewhere in the sheet).
I plugged this question and script into Chat GPT and got exactly what I needed for applying a sorting to multiple sheets: function onEdit(event) { // List of sheet names to apply the sorting to var sheetNames = ["FirstSheet", "AnotherSheet", "YetAnotherSheet"]; // Add the names of the sheets you want to include var c = event.range; // Get the cell that was edited // Column to sort by (e.g., column 1 for column A) var srtby = 1; // Change this to the position of the column you want to sort by // Range of cells that you want to sort (don't include the column headings) var t = "A3:DB24"; // Change this to the range of cells that you want to sort // Get the sheet where the edit happened var sheet = event.source.getActiveSheet(); // Check if the edited sheet is in the list of sheets to apply sorting if (sheetNames.includes(sheet.getName())) { // If the edited column is the column we want to sort by if (c.getColumn() == srtby) { var range = sheet.getRange(t); range.sort({ column: srtby, ascending: true }); // Change to false if you want to sort in descending order } } }
Hello! So I've been using the script for about a week now and at first it worked perfectly good. But now, it's kind of glitching. Like now, when I try to put a value in, it doesn't autosort anymore. I didn't change anything on the script or anything like that but it seems to have just stopped working. Do you have an idea of why that is?
I'm using this, but want to apply the sorting to 5 sheets (tabs) in the same project. Do i somehow apply the script 5 times, or is there a way to list multiple sheets on line 2 of the script?
you need to copy and paste the final line of the code to above it, replacing "srtby" with the number of the column you want to sort by. inside the "if" statement add: "|| c.getColumn() == number" with the number being the number of column you sort by. you can repeat this how many times you'd like for every column to sort by, with the one with the least priority corresponding to the highest line of code.
Thank you for spoon feeding this to me! I found a few other videos that explained what you was explaining however, i was struggling to wrap my head around it. Very helpful video.
This is soo amazing. Thanks for sharing this
Hi! amazing tutorials. Thanks. Can I ask if there's a way to have automatic arrangement? I have a CountA formula in my column B so that whenever I add new info on different sheets, it will show up in the summary or scoreboard. I noticed it doesn't automatically rearrange to descending or ascending unless I type a new number then it will arrange itself just like in your tutorial. Hope I explained my question clearly.
Thank you so much. 🙏
This works perfectly! Thank you Chester.
How do I modify the script to make the auto sort work in multiple tables in the same sheet and in multiple sheets of the same google sheets file?
It would be very helpful as a lot of people would require this to work in multiple tables of the same sheet and other sheets in the same file..
Please help :)
I can't seem to get it to sort when the sort column is formula... If I re copy the formula down the column the sort kicks in (I assume it's detecting that as the edit event rather than the formula simply updating based on edits elsewhere in the sheet).
Thank you, Sir. How to apply this for multiple sheets?
I have the same question.
I plugged this question and script into Chat GPT and got exactly what I needed for applying a sorting to multiple sheets:
function onEdit(event) {
// List of sheet names to apply the sorting to
var sheetNames = ["FirstSheet", "AnotherSheet", "YetAnotherSheet"]; // Add the names of the sheets you want to include
var c = event.range; // Get the cell that was edited
// Column to sort by (e.g., column 1 for column A)
var srtby = 1; // Change this to the position of the column you want to sort by
// Range of cells that you want to sort (don't include the column headings)
var t = "A3:DB24"; // Change this to the range of cells that you want to sort
// Get the sheet where the edit happened
var sheet = event.source.getActiveSheet();
// Check if the edited sheet is in the list of sheets to apply sorting
if (sheetNames.includes(sheet.getName())) {
// If the edited column is the column we want to sort by
if (c.getColumn() == srtby) {
var range = sheet.getRange(t);
range.sort({ column: srtby, ascending: true }); // Change to false if you want to sort in descending order
}
}
}
@@chrisgodby7325 Did this work for you? I need the same thing but can't do it
JUST AN INQUIRY CAN THE ABOVE SCRIPT WORK ON AN IMPORTRANGE DATA
Hello! So I've been using the script for about a week now and at first it worked perfectly good. But now, it's kind of glitching. Like now, when I try to put a value in, it doesn't autosort anymore. I didn't change anything on the script or anything like that but it seems to have just stopped working. Do you have an idea of why that is?
I'm using this, but want to apply the sorting to 5 sheets (tabs) in the same project. Do i somehow apply the script 5 times, or is there a way to list multiple sheets on line 2 of the script?
I'm wondering how to use this to sort by one column and then another column...it doesn't look like this person replies to questions, though?
you need to copy and paste the final line of the code to above it, replacing "srtby" with the number of the column you want to sort by. inside the "if" statement add: "|| c.getColumn() == number" with the number being the number of column you sort by. you can repeat this how many times you'd like for every column to sort by, with the one with the least priority corresponding to the highest line of code.