To alphabetize a list in Google Sheets, enter =SORT(A2:A20,1,TRUE) in an empty cell, assuming the names are in A2:A20; the result is a separate, ascending A-to-Z list. To alphabetize complete records rather than names alone, sort the full table range, such as =SORT(A2:C20,1,TRUE).
The basic Google Sheets alphabetize formula
SORT returns the rows of a range in a chosen order. In the first example, the range contains one column, the sort column is 1, and TRUE requests ascending order. For text, that gives the familiar A-to-Z arrangement. Change the last argument to FALSE to sort Z to A.
For example, with names in A2:A5—Mina, Alex, Zoe, and Ben—the formula =SORT(A2:A5,1,TRUE) returns Alex, Ben, Mina, Zoe in the cells below the formula. The source cells remain in their original order. This is useful when you want an alphabetized view without changing the data that other formulas, collaborators, or processes rely on.
Put the formula in a blank cell with enough unused space below it for the results. If the sorted output would overlap existing content, Sheets cannot expand the result and displays an error. The function does not sort the source range in place; it creates an array of results in the formula’s location.
Alphabetize complete rows, not just one column
If a name is associated with an email address, department, phone number, or other fields, sort the entire table range. Sorting only the name column in a copied output would separate each name from its details. With names in A2:A20, email addresses in B2:B20, and departments in C2:C20, enter =SORT(A2:C20,1,TRUE) in an empty area. The full rows appear in name order, keeping each record together.
The second argument is the sort-column number counted from the left edge of the range—not the worksheet’s column letter. For A2:C20, 1 means column A, 2 means B, and 3 means C. If you sort B2:D20 by its first column, use 1, even though that first column is worksheet column B.
To order a table by department, assuming the data range is A2:C20 and department is in its third column, use =SORT(A2:C20,3,TRUE). Names within each department are not automatically sorted as a second key; they remain in the order produced by the primary sort unless you specify another key.
Sort by last name or use multiple sort keys
When a full name is stored in one cell, a standard alphabetic sort orders by the text in that cell from its beginning. It does not identify a surname hidden at the end. If the sheet has first names in A and last names in B, sort the two-column range by its second column. Assuming those fields are in A2:B20, use =SORT(A2:B20,2,TRUE). The first and last names stay together, and the list is ordered by last name.
You can add a second sort key to resolve ties. With first names in A2:A20 and last names in B2:B20, assuming both columns form the range A2:B20, use =SORT(A2:B20,2,TRUE,1,TRUE). This sorts by last name first and first name second, both ascending. In each extra pair of arguments, provide a sort-column number relative to the range, followed by TRUE for ascending or FALSE for descending.
If the source contains only full names and no separate surname field, consider adding a last-name column if surname-based ordering matters. A formula cannot reliably infer every person’s family name from a string: names can include multiple given names, compound surnames, prefixes, or different naming conventions. Sorting the text as entered is predictable; parsing people’s names may not be.
Keep headers out of the sorted results
A header such as “Name” is usually meant to stay above the list, not be treated as a record. Start the formula range below the header. If the heading is in A1 and names are in A2:A20, use =SORT(A2:A20,1,TRUE) in a separate output area. For a table with headings in row 1, sort A2:C20 rather than A1:C20.
For a growing list, you can use an open-ended range so new entries below the current data are included. If names begin in A2, =SORT(A2:A,1,TRUE) sorts from row 2 down. Open-ended ranges can also include blank cells, so the output may contain empty results after the names. Whether that is acceptable depends on how the sorted list will be used.
To exclude empty name cells, assuming names start at A2, use =SORT(FILTER(A2:A,A2:A<>""),1,TRUE). The inner FILTER keeps only cells that are not empty, and SORT alphabetizes what remains. For a table in A2:C, where column A determines whether a row is populated, use =SORT(FILTER(A2:C,A2:A<>""),1,TRUE). This keeps entire nonblank records and sorts them by the first column.
Formula sorting versus sorting the original data
Choose a formula when you want a live, rearranged view while leaving the original rows untouched. The output updates when the source values change, which is handy for dashboards, summaries, or a read-only alphabetized list shared alongside a working table. It is also a safer choice if the source order has meaning, such as entry order or a sequence used by another task.
Choose a menu sort when you want the existing data itself to be rearranged. In Google Sheets in a web browser, select the relevant range and choose Data > Sort range > Advanced range sorting options. In the dialog, indicate whether the data has a header row, choose the column, and select A to Z or Z to A. For a whole sheet, use Data > Sort sheet and select the column and direction. Check the selected range before sorting so associated columns move with the names.
A menu sort is a one-time change to the data, while a formula produces a separate result that recalculates. A formula is not a substitute for sorting the source if another person or process expects the actual rows to be in alphabetical order. Conversely, sorting the source repeatedly can disturb an order you meant to preserve. Decide whether you need a changed table or an additional sorted view.
Common problems and how to fix them
- The formula shows an expansion error: Clear the cells where the result needs to appear. An array result needs an unobstructed output area; a value or merged cell in its way can prevent it from expanding.
- The header appears in the list: Exclude the heading row from the range. Start at row 2 when row 1 contains column labels.
- Names are sorted but their details are not: Include every related column in the SORT range. Sorting just A2:A20 cannot carry values from B2:C20 along with those names.
- The order seems unusual: Check for leading spaces, inconsistent spelling, or values that are not actually stored as text. Clean or standardize the source data if needed; sorting rearranges values but does not correct them.
- Blank entries appear: Use FILTER to remove empty rows before sorting, or use a fixed range that ends at the last relevant row.
- The formula is rejected after pasting: Confirm the parentheses and commas, and check the spreadsheet’s locale. Some locales use semicolons as formula separators instead of commas, even though the function and argument order are the same.
Also distinguish between a formula result and an editable list. The sorted output is calculated from its source; it is not an independent copy to edit freely. Change the original values to change the result, or copy the output and use Edit > Paste special > Values only if you need a static copy. A pasted-values copy no longer updates when the source changes.
Google Sheets and Excel: what carries over?
The basic SORT function is also available in current Microsoft Excel versions that support dynamic-array formulas, including Microsoft 365. The example =SORT(A2:A20,1,TRUE) uses a compatible argument pattern in both programs. Excel’s interface is different: in Excel for Microsoft 365 on Windows, a one-time sort is available from Data > Sort & Filter > Sort A to Z, while Google Sheets uses its browser-based Data menu.
Do not assume that every Sheets feature or menu path has an identical Excel counterpart. If a workbook will move between products, check the specific formulas and behavior in the destination application. For a straightforward alphabetized list or table, however, SORT is a useful and familiar approach in both spreadsheet programs.
Frequently Asked Questions
What formula sorts names A to Z in Google Sheets?
With names in A2:A20, use =SORT(A2:A20,1,TRUE) in a blank cell. The formula returns an ascending list in a separate area and leaves the source cells unchanged.
How do I sort Z to A?
Use the same range and sort-column number, but set the final argument to FALSE. For names in A2:A20, enter =SORT(A2:A20,1,FALSE).
How do I alphabetize names and keep each row together?
Include the whole record in the range. If the names and related fields occupy A2:C20 and the names are in the first column of that range, use =SORT(A2:C20,1,TRUE).
Can Google Sheets sort by last name?
Yes, if last names are in their own column. For a range A2:B20 with last names in column B, use =SORT(A2:B20,2,TRUE). If each full name is stored in one cell, the ordinary sort uses the text as entered; it does not automatically extract surnames.
Does SORT change my original list?
No. A SORT formula returns a calculated result elsewhere in the sheet. To rearrange the original data, use the Data menu’s sort options instead, making sure the selected range includes all columns that belong to each row.
Related
- Power Query: Select Columns and Keep the Fields You Need
- Google Sheets Data Cleaning: Tools, Steps, and Tips
- How to Add an Image Box to an Excel Data Entry Form
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 Page in Word With a HeaderTo delete a page in Word that has a header, remove the page’s body text or the break…
- How to Make Cell Borders White in Microsoft Excel 365To make cell borders white in Excel, select the cells, open Home > Borders > More Borders, choose…
- How to Join Two Cells in Google Sheets: Merge CellsTo join two adjacent cells in Google Sheets, select them, then choose Format > Merge cells and pick…
- Hanging Indent in Word: Set It Up Step by Step in MinutesTo create a hanging indent in Word, select the paragraphs you want to format, open the Paragraph settings,…
- How to Clear Cache in MS Outlook Without Losing MailTo clear Outlook’s local mailbox cache in classic Outlook for Windows, close Outlook, rename its Exchange or Microsoft…
- Excel Sharing Violation: Causes and FixesAn Excel sharing violation usually means Excel cannot save to the workbook because another user, program, or file-system…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.