About Uisoftbank

We gather useful software and tips to save your time and money for your business. 

How to Sort by Date in Google Sheets? The Complete Guide

The process of how to sort by date in Google Sheets may seem like a daunting task. But using methods introduced in this article, you can easily arrange your data in an accurate manner.
how to sort by date in google sheets

In order to better understand data, you should sort it chronologically when you have a lot to do. As a result, it will be easier for you to find the specific information you seek. We’ll cover different methods for how to sort by date in Google Sheets, so you can choose what works best for you.

How to Sort by Date in Google Sheets? Three Effective Ways

An organization of data is most meaningful when it follows a pattern. This is regardless of whether it is arranged in ascending or descending order by dates, serial numbers, or some other metric.

Imagine we have many transaction data with dates associated with them. Would it be possible to get the first transaction date? The time has come to sort by date.

It is difficult to sort multiple columns by date and frustrating. Fortunately, there are a few steps we can take to make the process move much more smoothly. Here are three different ways to sort data by date in Google Sheets.

Way 1. Using Filter

When it comes to sorting data in Google Sheets by date, the filter function is the best way to go. With the filter command in Google Sheets, you can narrow down a dataset conditionally, i.e. with date in our case. The following step-by-step example shows how to sort rows by date in Google Sheets;

Step 1: Create a data sheet

First of all, enter the data that shows sales for various products by date as follows:

Create a Sheet in Google Sheets

Step 2: Filter by Date Range

Consider applying a filter to only display rows whose date falls between 1/5/2020 and 1/15/2020. You can do this by clicking cell A1, selecting the Data tab, and then clicking on Create a filter:

Create a filter in Google Sheets

Step 3: Selecting the dates

You can then filter the data by clicking the Filter icon next to the date. Click on Filter by condition and select None. Using the dropdown menu, select Is between and then enter 1/5/2020 to 1/15/2020:

Filter by condition

Step 4: Finalize

Upon clicking OK, you will be able to see only those rows where the date falls between 1/5/2020 and 1/15/2020.

Finish to filter in Google Sheets

Way 2. Using SORT  

In Google Sheets, the easiest way to sort the data is through the SORT function “Google Sheets sort by date”. You can use the SORT function to create a new table in date order while leaving your original data untouched. You’ll see the sorted data in the cell where the formula was typed, starting from there. Here’s how you do it step-by-step;

  • Choose the sheet where the dataset is to be sorted. To populate an empty column with the sorted data, place your cursor in that column. Rather than modifying the fields with the original data, the sort creates new fields. The new columns can also be labeled, as we have done here.
Choose the sheet to sort in google sheets
  • At the top of the page, type =SORT (A2:B6,2, TRUE) into the formula bar. A2:B6 indicates the sort range, 2 indicates the sort column (the second column which is of dates in the dataset), and TRUE indicates ascending sort order.
Insert sort format in google sheets

You can type FALSE in the formula for descending order.

  • Using your keyboard, hit the Enter key. Sorting is performed automatically, with entirely new cells being filled from the cursor position onward.
Sort successfully in google sheets

Way 3. Using SORT Range

If you’re still looking for an alternative way of how to sort things by date in Google sheets. Here’s another one. With Google Sheets, you can sort your data quickly using the Sort Range feature.

Step 1:

Add any dataset having several dates of different durations. Ensure all your dates are properly formatted in date format. Incorrectly formatted dates will not work with sort methods.  

Add any dataset in google sheets

Step 2:

Select the dataset as shown and go to the Format tab. In the Format tab, select Numbers, and then click on Date. Dates will then be formatted correctly.

format date in google sheets

Step 3:

Now select your dataset, including the header. Navigate to the Data tab, then Sort range, and then choose advanced range sorting options.

choose advanced sorting options in google sheets

Step 4:

The dialog box will appear on selecting advanced range sorting options. Check the “Data has head row” to start. If there are no headers, then you can leave this checkbox unchecked. You can then pick your column name in the dropdown list, check the A-Z sorting box, and then click the sort button

Set sort range in Google Sheets

Your data will be sorted automatically.

Sort data successfully in Google Sheets

Extra Tip:

You can repeat the process if you have more than one range of columns, by clicking on the Add another sort column button.

Add another sort column button in Google Sheets

How to Automatically Sort by Date in Google Sheets?

There are many people out there who want their data to be automatically sorted. In other words, they want to sort data once, and then whenever new data is added, it will get automatically sorted. So, let’s try to make things easier for them. Here are the steps to automatically sort your data in Google sheets.

Step 1:

Insert any random data in your Google sheet to try out how this works.

Insert data in google sheets

Now head to extensions, and then click on “Apps Script”.

Apps Script in Google Sheets

Step 2:

It will take you to a new window of Apps Script where you can see an untitled project, and delete whatever is there.

New file in apps script in Google Sheets

Now open Mike’s script from Github and copy all of that data code.

copy mike code to apps scripts

Paste the copied data in your Apps Script window and save the project. You can rename your project as “Automatically Sort Data” to make it easier for you.

paste the code to apps script in Google Sheets

Step 3:

After pasting the code, there are a few changes that you need to make according to your data in Google Sheets.

update code in apps script in google sheets

The column 2 means the data that needs to be sorted is in column 2. Here in our case, the data is in column A. So replace 2 with 1 and False with True as we want data in ascending order. If you want the data to be in descending order, then you can continue with false. Lastly, the number of header rows, as in our case there’s just one 1 static row with data title so we will go with 1.

Update number of row in apps script

After making your changes, save this project again and close the tab.

Step 4:

Now close the Apps script window and head back to Google Sheets, Refresh the window.

automatically sort date in google sheets

On refreshing the page, you’ll see your data is automatically sorted in ascending order. Try adding a new number in your data randomly and press Enter on your keyboard.

enter a number to automatically sort date in google sheets

The newly added number automatically gets sorted in ascending order.

the new number automatically sorted in google sheets

So, this is how you automatically sort your data in Google sheets. In case of any errors or anything read out the script to get more guidelines.

If you found it difficult to follow with text guide, you can watch this video tutorial.

Why Can’t I Sort by Date in Google Sheets?

Sometimes you are trying to sort your data in Google sheets but it doesn’t work. There can be a couple of reasons behind this. Let’s learn more about these and how to fix them;

Reason 1. Sort Range not working

The Sort Range option may not appear and be grayed out if no range has been selected. According to the principle of the SORT function, the range must be highlighted in order to sort rows according to data in columns.

To solve this issue, make sure your selected range is highlighted.  

Reason 2. Wrong Date Format

Wrong date format can be one reason why you can’t sort by date in Google Sheets. When you enter the date manually, there are chances of your format being MM//DD/YY but you didn’t check it and entered the date as 14/07/2022 because you thought the format to be DD/MM/YY.

To solve this issue, go to the Date column, then select “Format” > “Number” > “Date” to make them the same. Or you can use the ISDATE () Function as below;

Using the ISDATE function is another method of determining if Google Sheets has set a cell as date. The function takes a single parameter and simply returns TRUE or FALSE depending on whether the cell is a date.

Reason 3. Improper Alignment

Another reason for errors in sorting data by date can be improper alignment. The date must be recognized by Google Sheets as valid in order to work as a number. When Sheets doesn’t recognize your date, it won’t be able to sort it with other dates. To check whether Google sheets have recognized your date is by check the alignment of entered data. The value of a date will be right-aligned when Sheets recognizes it as a date and on the left when it isn’t recognized as a date.

Therefore, you should always make sure that your data set is aligned properly and look for any misaligned fields.

Final Words

During the course of our work with data, we find that sorting is a very helpful feature. In this article, we learned how to sort by date in Google Sheets with different methods. So hopefully you’ll be able to choose one that works for you.

You May Also Like

How to Add Code Block to Google Docs Without/With Addon? (Detailed Steps)

How to Embed Google Calendar into Notion With/Without Making It Public?

5 Best Google Sheets Alternative to Easier Your Work

Share This Post