There are easy ways in which you can sort your data automatically in Google Sheets and, I have put together some of them in this tutorial; just for you!
Hello and welcome to TeqTog – your hub for tips and tutorials on Google Sheets and, in this article, I am going to show you how you can easily automatically sort in Google Sheets.
How to Automatically Sort Alphabetically in Google Sheets
While you always have the option of manually sorting your data in an alphabetical order in Google Sheets; that can become tedious and frustrating. Here is how you can automate the process of sorting data alphabetically in your spreadsheet.
If you want to set your alphabetical order in an ascending manner then, first off, you need to learn the formula:
=sort(A2:B, 1, TRUE)
The syntax of this formula is easy to understand: the sort is the function for sorting. Moreover, A2:B is the range of data which I wish to sort out and, I inserted “TRUE”
Because, the formula wanted to know whether I wish to organize my data in an ascending manner; and since that’s true I gave “TRUE”.
Lastly, 1 is the column number which is the basis for your data sorting.
Suppose, I have a list of names and I want to organize them in an ascending order alphabetically.
- Select a cell in which I will type the formula
- Insert the formula I showed above.
- Press the “Enter” key to get the results.
As you can see from my example, my data has been sorted.
Similarly, if you want to sort your data in a descending order, then just insert “FALSE” in the place where I previously gave “TRUE” in the formula and spreadsheet will do it in a descending order.
And now I have data which is sorted in both orders.
Automatically Sorting Data using Script Editor
Another way in which you can ensure automatic data sorting is by creating a function to just that. How can you do this? Here are the steps below:
- Find “Extension” from the top menu bar and select “Apps Script” from the drop-down menu. A new window will open and, in the space where you need to write your code, insert the following:
For the “getSheetByName” I gave the name I have given to my spreadsheet. In this case, this was “Worksheet”.
For “ws.getRange” I gave the column number and the row number in which I have my data and, I inserted “ws.getLastRow()-1,) because, the first row is for the title “Names” so that is not a part of our actual data.
For “range.sort”, I gave the column number and selected true because, the options said “ascending”.
- Now, I will run this code
- And, my data will be sorted automatically!
To learn more about Scripts Editor – make sure to check out my Google Spreadsheets Script: Beginner’s Guide
Auto Sorting by Column in Google Sheets
You can also sort your spreadsheet by considering entire columns. Here’s how you can do that:
- You have to select the column that you want to sort and to do that, you just need to select any cell from that column.
- Find “Data” from the top menu bar and select the first option “Sort sheet”. From there, you can choose whether you want your data to be sorted in an ascending order or descending order.
I chose to sort in a descending order, therefore:
And there you have it! I hope my article on how you can automatically sort data in Google Sheets helped you out.
Best of luck!
You May Love to Read More Google Sheets Tutorial Articles on: