How to Sort by Month in Excel & Google Sheets
In this tutorial, you will learn how to sort by month in Excel and Google Sheets.
Sort by Month as Text
Say you have the following list of months as text in Column B and want to sort them chronologically from oldest to newest.
- Select a range with its header for sorting (B1:B10), and in the Ribbon go to Home > Sort & Filter > Custom Sort.
- In the Sort window, under Order, choose Custom List…
- In the Custom Lists screen, select January, February, March, … from the list on the left and click OK.
- Now in the Sort window, under Order you have the custom list for months. Click OK.
Finally, all months from Column B are sorted chronologically.
Sort Dates by Month
Say you have a list of dates in Column B and want to sort them by month, regardless of year, from January to December.
To achieve this, you’ll need to add one helper column.
- In cell C2, enter the formula:
=MONTH(B2)
The MONTH Function returns the number of the month based on a date input. In this case, the value of C2 is 2 (February).
- Position the cursor in the bottom right corner of cell C2, until the cross appears.
- Drag the formula down to the end of the range (C10).
- Now you have a month number for every date in Column B, and you can sort both columns based on Column C.
Select the range in Column C (C1:C10). Then in the Ribbon, go to Home > Sort & Filter > Sort Smallest to Largest.
- In the pop-up window, choose Expand the selection, and click OK.
As a result, both columns are sorted by the month number in Column C, and you can delete helper Column C. Dates in Column B are now sorted by month from oldest to newest.
Sort Months as Text in Google Sheets
Since Google Sheets don’t have an option similar to Excel’s custom lists, you’ll have to use an array formula to sort months as text.
To do this, enter this formula in cell C2:
=SORT(B2:B10,MONTH(B2:B10&1),1)
In this case, the MONTH Function has a range, instead of a single value, as an input. This variant will return an array of numbers 1–12 (for each month) sorted in ascending order. As the SORT Function is the array itself, it will take the values from B2:B10 as an array and sort them accordingly from cell D2 downward. This way, you get all months from Column B, sorted in Column C from oldest to newest.
Sort Dates by Month in Google Sheets
To sort dates by month in Google Sheets, you can use the same option with a helper column and the MONTH Function as explained for Excel. The formula is nearly the same as the one in the previous step, which you used to sort months as text:
=SORT(B2:B,MONTH(B2:B) ,TRUE)
The logic here is the same. The MONTH Function will sort dates in the range from oldest to newest, and the SORT Function will create a new array in Column C based on that list.