Fix Excel Not Sorting All Rows in a Data Range
Question details
The user needs to sort an entire Excel dataset when the final records are excluded from the sort operation.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet with a large data range sorts correctly in smaller sections, but the last few rows are not included.
- Observed behavior
- Excel stops the selected sort range before the final records, leaving those rows unchanged.
Click a cell in the dataset and check whether blank rows or blank columns divide the final records from the main table. Ensure the row that contains your field names is the only header row in the range.
Select the complete Excel range before sorting
Use this when Excel detects only part of the table or leaves the final rows unchanged after a sort.
Excel can sort far more than 10,000 rows. When only some rows are sorted, the usual cause is that Excel identified a smaller current region because the data is separated by an empty row, empty column, or incomplete selection.
Click a cell in the main dataset, then press Ctrl+A once to select the current data region. Confirm that the selection includes the last records that were previously excluded.
Look between the main records and the excluded rows for a fully blank row or column. Delete the blank separator, or select the complete range manually by dragging from the first header cell through the final used row and column.
On the Data tab, select Sort. If your selected range includes field names, select the My data has headers check box.
If Excel displays a Sort Warning, choose Expand the selection and select Sort so that every related column and row moves together.

Clean hidden characters and inconsistent values in the sort column
Use this when the complete range is selected but some values appear in an unexpected position after sorting.
Sort Every Row in a Spreadsheet with WPS Office
WPS Spreadsheets lets you select the full dataset, expand the sort range, and sort records by one or more columns. Its familiar spreadsheet interface helps you review blank separators and clean inconsistent values before sorting.
- 1. Open the workbook in WPS Spreadsheets: Launch WPS Office, choose Spreadsheets, and open the affected .xlsx or .xls workbook.
- 2. Select the full dataset: Drag from the header row to the last record, ensuring no blank row or blank column separates the selected data.
- 3. Start the sort command: Go to the Data tab and select Sort, then choose the column and order you want to use.
- 4. Confirm the header and range settings: Enable the header option when the first row contains labels, then confirm that the displayed range includes every record.
- 5. Apply the sort: Select OK to sort all selected rows together and verify that the final records moved with the table.

Frequently Asked Questions
Can Excel sort more than 10,000 rows?
Yes. Excel can sort datasets larger than 10,000 rows. If the last rows are excluded, check the selected range and look for blank rows or columns that split the dataset.
Why does Excel stop selecting my table before the last rows?
Excel's current-region selection stops at a completely blank row or column. Remove the separator or manually select the entire range before choosing Data > Sort.
What should I choose in the Excel Sort Warning dialog?
Choose Expand the selection when the adjacent columns belong to the same records. This keeps each row intact while Excel sorts the chosen column.
How can I find invisible characters that affect Excel sorting?
Use =LEN(cell) to compare character counts. To inspect a character code, use =UNICODE(MID(cell,position,1)); TRIM and CLEAN can remove many unwanted spaces and non-printing characters.
Why do numbers sort as text in Excel?
Numbers stored as text may sort alphabetically rather than numerically. Use Data > Text to Columns > Finish, or convert the values to numbers and then run the sort again.




