How to Make Columns Sortable in Excel & Google Sheets
This tutorial demonstrates how to make columns sortable in Excel and Google Sheets.
Sortable Headings in Excel
Excel has some great built in database features which make ordering and sorting data easy when your data is formatted as a table. This means that the data should be organized into columns that contain column headings in the first row, with the data contained in the rows beneath it.
Consider the data in the spreadsheet below.
Each column of data has a heading with the information contained in the rows below.
- Notice that a small arrow appears to the right-hand side of each cell that contains the column headings. This indicates that a filter has been attached to each column.
- Click the drop down for the column you wish to sort (in this case, Order Date), and then choose either Sort Oldest to Newest or Sort Newest to Oldest.
- The data gets sorted based on your choice, and you can see that the drop-down arrow has another little arrow to the right of it –either pointing downward (if you sort newest to oldest) or upward (if you sort oldest to newest).
- Click back on the filter button in the Data tab on the Ribbon if you wish to remove the filter drop downs from the column headings.
You can also use the Custom Sort feature to sort using your column headings.
- With your mouse clicked within the table of data, in the Ribbon, go to Data > Sort & Filter > Sort.
- Then in the Column Sort by drop down, choose the column header (field name) you wish to sort on.
- In the Order drop down, choose to sort Oldest to Newest, Newest to Oldest, or a Custom List.
- Click OK to sort. (Make sure to keep rows together.)
Also see Sorting Data in Excel VBA and VBA AutoFilter to learn about filtering and sorting data with macros.
Sortable Columns in Google Sheets
You can also use a filter in Google Sheets to make your columns sortable. As with Excel, the data needs a heading for each column.
- Click within your data and then, in the Menu, go to Data > Create a filter.
- Then, click the filter arrow next to the column you wish to sort, and choose either Sort A→Z or Sort Z→A.