How to Sort Excel Data and Keep Blank Cells at the Bottom
Question details
The user wants to sort and filter a data range from another worksheet so that populated records are sorted and blank rows are pushed to the bottom.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Sorting and filtering data pulled from another worksheet or dynamic range without breaking the layout.
- Observed behavior
- Dynamic-array formulas may cause spill errors or sort blank cells incorrectly to the top of the dataset.
Ensure your source data does not contain merged cells, as they can interfere with dynamic array formulas and sorting functions. It is highly recommended to convert your data into a structured table first.
Use Dynamic Array Formulas with Structured Tables
Combining SORT and FILTER functions with an Excel Table prevents spill errors and automatically expands when new data is added.
By converting your source data into a structured table, you ensure that any new rows added are automatically included in your formulas. Using the FILTER function removes the blank rows before the SORT function processes the data.
Select your source data range and press Ctrl+T to convert it into a structured Excel Table. Note the table name (e.g., Table1).
Navigate to a blank worksheet or an area completely outside the table where you want the sorted data to appear.
Type the formula =SORT(FILTER(Table1,ISTEXT(Table1[Column1]))) into the first cell of your destination range. Replace 'Column1' with the actual name of the column you are checking for text.
Press Enter. The formula will dynamically filter out blank rows and sort the remaining text data, spilling the results into the adjacent cells.

Use Power Query to Sort and Remove Blanks
Power Query is a robust alternative for transforming data, removing blank rows, and sorting records without complex formulas.
Sort and Filter Data Dynamically with WPS Spreadsheet
WPS Spreadsheet fully supports dynamic array formulas, structured tables, and advanced sorting features. You can easily manage large datasets, filter out blank cells, and sort records without worrying about compatibility issues.
- 1. Open Your Workbook: Launch WPS Spreadsheet and open the workbook containing your source data.
- 2. Format as Table: Select your data range, go to the Insert tab, and click 'Table' to create a structured table.
- 3. Apply the Formula: In a new sheet, type =SORT(FILTER(Table1, Table1[Column1]<>"")) to extract and sort non-blank data.
- 4. View Dynamic Results: Press Enter to see the dynamic array spill perfectly into the cells below, keeping blanks out of your sorted list.

Frequently Asked Questions
Why do blank cells appear at the top when I sort in ascending order?
In standard sorting, spreadsheet software treats blank cells differently depending on the sort method and data types. Using the =SORT(FILTER(...)) formula ensures that blank cells are completely excluded from the sorted array, effectively keeping your populated data together.
What is a #SPILL! error and how do I fix it?
A #SPILL! error occurs when a dynamic array formula (like SORT or FILTER) does not have enough empty cells below or to the right to display all its results. To fix it, clear any data, spaces, or hidden characters in the cells where the formula needs to expand, and ensure you aren't placing the formula inside a structured table.
Can I sort data with blank cells without using formulas?
Yes. You can use the built-in Custom Sort feature. Select your data, go to the Data tab, click Sort, and apply your criteria. However, to automatically push blanks to the bottom dynamically as data changes, using Power Query or dynamic array formulas is highly recommended.




