Google Sheets Equivalent for an Excel SORT Formula
Question details
The user needs to find a Google Sheets equivalent for an Excel array-based SORT formula to sort data by the second column, and then by the first column.

- Product
- Google Sheets
- Device & OS
- not provided
- Scenario
- An existing Excel workbook containing a dynamic SORT formula was uploaded to Google Drive and opened in Google Sheets.
- Observed behavior
- The original Excel array-based SORT formula does not work or evaluate correctly in Google Sheets, failing to sort the data properly.
Ensure that the destination area where you intend to place the formula has enough empty cells below and to the right, as array formulas require space to expand and display all sorted data.
Use the Google Sheets Native SORT Function
Replace the Excel array formula with Google Sheets' native SORT syntax to sort multiple columns effectively.
Google Sheets features its own SORT function structure that handles array outputs efficiently. To replicate Excel's sorting logic, you need to define the range, the primary column to sort by, whether it should be ascending or descending, followed by secondary column criteria.
Click on the top-left cell in a blank area of your Google Sheet where you want the sorted array to appear.
Type `=SORT(MASTERbyYEAR!A2:F300, 2, TRUE, 1, TRUE)` into the formula bar.
In this formula, `MASTERbyYEAR!A2:F300` is the data range. `2, TRUE` tells Google Sheets to sort by the second column in ascending order. `1, TRUE` applies a secondary sort by the first column in ascending order.
Press the Enter key. The formula will execute, and the sorted data will automatically spill over into the adjacent rows and columns.

Sort Data Seamlessly with WPS Spreadsheet
Avoid formula conversion errors by managing your spreadsheets directly in WPS Office. WPS Spreadsheet provides excellent compatibility with Excel formulas, ensuring complex dynamic arrays and sort functions work exactly as they do in Microsoft Excel.
- 1. Open your workbook: Launch WPS Spreadsheet and open your existing Excel (.xlsx) file directly.
- 2. Apply or edit the formula: Use your standard Excel array formulas without needing to translate syntax, or use the visual Sort feature under the Data tab.
- 3. Save without formatting loss: Save your work locally or upload it to WPS Cloud. Your complex formulas will remain perfectly intact for future edits.

Frequently Asked Questions
Why did my Excel SORT formula break in Google Sheets?
Microsoft Excel and Google Sheets handle dynamic arrays and specific function syntaxes differently. Excel's newer SORT and SORTBY setups often require manual conversion to Google Sheets' native `=SORT(range, sort_column, is_ascending)` structure to work properly.
How do I sort by descending order in the Google Sheets SORT formula?
Change the boolean value in the formula from TRUE to FALSE. For example, using `=SORT(A2:F300, 2, FALSE)` will sort the second column from highest to lowest (or Z to A).
Can I sort by more than two columns using this formula?
Yes, you can add additional column indices and sorting criteria to the end of the Google Sheets SORT formula. Just append `, column_index, TRUE/FALSE` for each additional column you want to include in the sort hierarchy.
What does the #REF! error mean when using the SORT function?
The #REF! error usually indicates that the array result was blocked from expanding because there is existing data in the adjacent cells. Clear the surrounding cells so the formula has enough room to spill the sorted data.




