Yes. In Google Sheets, you can sort by multiple columns by selecting your data and choosing Data > Sort range > Advanced range sorting options, then adding sort columns in priority order. For a formula-based result, use the SORT function with multiple column-and-order pairs.
What multiple sorting means
A multiple-column sort, also called a multi-level sort, applies one sorting rule and then uses additional rules to order rows that tie under the earlier rule. The first sort column has the highest priority. The second column matters only among rows with the same value in the first column, and later columns break any remaining ties.
For example, a class list might be sorted first by homeroom and then by student surname. The result groups students by homeroom, while arranging names alphabetically inside each group. Sorting by surname first and homeroom second produces a different result: students are grouped alphabetically, with homeroom used only to order students sharing a surname.
This is different from sorting one column by itself. Sorting just the homeroom cells could separate those values from the student names on the same rows. A proper range sort rearranges complete rows in the selected data range, preserving the relationship among each row’s entries.
Sort by several columns with the menu
Use the menu method when you want to rearrange the existing data and need a clear, adjustable sort order. Before sorting, check that the range includes every column whose values must stay together.
- Select the data range, including all related columns. If the data has a header row, include it as well.
- Choose Data > Sort range > Advanced range sorting options.
- If your selection includes column headings, select Data has header row so the headings are treated as labels rather than sortable records.
- Choose the first column to sort by and select A to Z or Z to A, as appropriate.
- Choose Add another sort column, select the next column and its direction, and repeat for any further criteria.
- Select Sort to apply the rules to the range.
The order of the sort columns in the dialog is important. Put the broadest grouping first, followed by the rules that should organize records within that group. You can mix ascending and descending directions; for instance, sort by department A to Z and then by sales from largest to smallest.
Choose sort priorities with a concrete example
Imagine a table with columns for Region, Salesperson, and Revenue. To group records by region, list names alphabetically within each region, and show each salesperson’s largest revenue first where names repeat, set the levels in this order:
- Region: A to Z.
- Salesperson: A to Z.
- Revenue: Z to A, which places larger numbers before smaller numbers.
Because Revenue is third, it does not put the highest revenue across the entire sheet at the top. It only orders rows that have the same Region and Salesperson values in the earlier levels. If the goal is instead to rank all sales records by revenue, make Revenue the first sort column.
It helps to describe the intended result in plain language before opening the sort dialog: “Group by X, then arrange each group by Y, and break ties using Z.” That sentence translates directly into the priority list. If a later rule never appears to change the order, the earlier columns may simply have no ties for it to resolve.
Headers, ranges, and keeping rows intact
Google Sheets sorts the range you specify, so selecting the correct boundaries matters. If a record spans columns A through F, select all six columns before sorting. Sorting only column A can mismatch names with the other details in their rows. If the table sits beside unrelated data, avoid selecting entire sheet columns unless those neighboring cells are meant to move with it.
Mark the header row correctly in the advanced sort options. If headings are included but the header option is left off, a label such as Region may be sorted among the data as though it were a record. If the selection starts below the headings, do not include an unrelated row above it. Blank rows within a table can also make its boundaries less clear, so inspect the selection before applying the sort.
Sorting changes the displayed row order in the chosen range; it does not create a separate sorted copy. Other people working in the same sheet may see the changed order. If you need to preserve the original sequence, make a copy of the tab or use a formula that returns a sorted view elsewhere. For collaborative sheets, filter views can be useful when different people need their own saved ways to inspect the same records.
Use the SORT function for a separate sorted view
The SORT function returns a sorted array without rearranging the source cells. This is useful for dashboards, reports, and views that should update as the source data changes. With records in A2:C10, where column A is Region, B is Salesperson, and C is Revenue, enter =SORT(A2:C10,1,TRUE,2,TRUE,3,FALSE) in an empty area. It sorts by the first column of the selected range ascending, then the second ascending, and then the third descending.
The numbers in the formula are positions within the range, not necessarily the worksheet’s column letters. In A2:C10, 1 means A, 2 means B, and 3 means C. TRUE means ascending order and FALSE means descending order. The source range in this example excludes the heading row because SORT does not automatically recognize or protect headings. Add headings separately above the formula output if needed.
Leave enough empty space below and to the right of the formula for the returned rows and columns. Existing content in the output area can prevent the array from expanding. The formula’s result is a view, so edit the original records—not the returned cells—to change the underlying data. Depending on the spreadsheet’s locale, formula separators may be displayed differently; the example uses commas.
Numbers, dates, blanks, and custom order
For numbers and dates, make sure the cells contain actual numeric or date values rather than text that merely looks similar. Text-formatted dates can sort alphabetically instead of chronologically, and numbers stored as text may appear in an unexpected order. Applying a number or date format changes how a value is displayed, but formatting alone does not always convert text into a real number or date.
Blank cells may sort differently from filled values depending on the sort direction and the data involved. If blank entries need a specific position, consider adding a helper column that labels rows as blank or nonblank, then sort by that helper first. Similarly, Google Sheets’ ordinary A to Z and Z to A choices do not provide an arbitrary custom sequence such as High, Medium, Low. Add a numeric rank in a helper column—such as 1 for High, 2 for Medium, and 3 for Low—and sort by that rank.
For example, if a priority column contains High, Medium, and Low, a rank column can define the desired order even though alphabetically those labels appear differently. Keep the rank column with the records while sorting, or include it in the SORT formula’s input range. You can hide a helper column after checking that it produces the intended order, but do not omit it from a menu sort if it needs to move along with each record.
Common multiple-sort problems
- Rows no longer match: The selection covered only one column. Undo immediately if possible, then select the full table and sort again.
- The heading moved into the records: The header-row option was not enabled, or the selection included the heading without marking it as a header.
- The wrong column is sorted first: The sort levels are in the wrong priority order. Move the desired primary grouping to the first level.
- Numbers or dates look out of order: Some values may be stored as text, contain inconsistent formats, or include spaces. Check the underlying cell values and standardize them.
- The formula gives an expansion error: Clear cells from the output area so the sorted array has room to appear.
- Nothing seems to change after adding another level: Later levels only distinguish rows tied on every preceding level. If there are no such ties, the extra rule has no visible effect.
If a sort produces an unexpected result, inspect the selected range and the first priority before changing the data. For a menu sort, Undo can restore the prior order when it is still available. A copy of important source data is a safer fallback, especially in a shared sheet where later edits may make the earlier sequence difficult to reconstruct.
Menu sorting, formulas, and filter views
Menu sorting is best when the table itself should be rearranged. It is direct and does not require a formula, but it changes the shared order of the selected range. The SORT function is better when you want a live, separate output that responds to source changes. Its output is not an editable replacement for the source records, and it needs clear space to expand.
A filter view offers another option when the purpose is to examine records without permanently changing the shared layout. In Google Sheets, filter views can apply sorting and filtering to a view of the data. They are especially useful when collaborators want different ways of examining the same table. They are not the same as a formula-generated report: they work with the source range rather than creating a separate array of results.
Choose based on what should happen to the original table. Use the advanced range sort to make a new row order the sheet’s working order, SORT to build an automatically updated sorted display, or a filter view to inspect a dataset using a saved view. For a one-time cleanup, the menu is usually simplest; for a recurring report, a formula may be easier to maintain.
Frequently Asked Questions
Can Google Sheets sort by more than two columns?
Yes. In the advanced range sorting options, add additional sort columns as needed. Each later column breaks ties left by the earlier sort levels.
Does Google Sheets sort the whole row or only the selected column?
A range sort rearranges the complete rows within the selected range. Include every column that belongs to each record; sorting only one column can disconnect values from the rest of the row.
Can I sort one column A to Z and another Z to A?
Yes. Set the direction separately for each sort level. For example, sort Department A to Z, then Revenue Z to A to put the largest revenue first within each department.
Can I sort by color and then by another column?
Google Sheets offers sorting by fill color or text color in supported sheet menus, but color sorting is not the same as an ordinary text or number priority level. If you need a dependable multi-level order based on category, use a helper value such as a rank and sort by that column.
Will a SORT formula include the header row?
Only if you include it in the formula’s input range. SORT does not identify headings automatically, so the usual approach is to sort the data rows and place headings separately above the formula result.
Related
- Insert a Line in Word or Google Docs: Quick Steps
- Insert a Functional Checkbox in Word: Clickable Options
- Insert an Empty Checkbox in Word: Easy Methods
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Delete a Blank First Page in Microsoft WordTo delete a blank first page in Microsoft Word, show formatting marks, remove any empty paragraphs or page…
- How to Remove Wrap Text in Google SheetsTo remove wrap text in Google Sheets, select the cells, then choose Format > Wrapping > Overflow. This…
- Schedule an Email in Outlook: Step-by-Step GuideTo schedule a one-time email in Outlook, write your message, open the menu beside Send, choose Schedule send,…
- Print Freeze Panes in Excel: Repeat Rows on Every PageTo print frozen rows or columns on every page in Excel, use Page Layout > Print Titles and…
- How to Calculate Pearson’s r in Google Sheets with CORRELTo calculate Pearson’s correlation coefficient, r, in Google Sheets, put one set of measurements in A2:A6 and the…
- How to Create Blank Address Labels in Microsoft WordTo create a sheet of blank address labels in Word, open Mailings > Labels, choose the label brand…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.