A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
The row count is not the issue in the provided guidance. The more likely causes are data consistency or the selected sort range.
Most likely reasons for the mixed result:
- The values in that column are not truly identical text values.
- Leading spaces affect sort order.
- Blank cells sort last, but cells that contain one or more space characters are not considered blank.
- If some entries contain hidden spaces,
PaymentandInvoicecan appear to sort unexpectedly.
- The sort range may not include the full data range.
- If there is a blank column inside the dataset, Excel may not treat all columns as one continuous range.
- A Microsoft Q&A example shows that a blank column can prevent the full row range from sorting together unless that blank column has a header.
- Hidden rows or columns can affect the result.
- Hidden rows are not moved when sorting rows, and hidden columns are not moved when sorting columns.
- Formula-based helper values may need the sort reapplied.
- If the helper column uses formulas, recalculation can change returned values, and the sort may need to be applied again.
What to check:
- Select the entire dataset before sorting, not just one cell.
- Unhide any hidden rows and columns.
- Check the sort column for leading spaces or cells that only look blank but actually contain spaces.
- If there is a completely blank column inside the data range, add a header to that column so Excel includes the whole range.
- If using the helper column, confirm the helper values are real numbers and then sort the full dataset by that column.
- In Home > Sort & Filter > Custom Sort, verify whether My data has headers is set correctly.
A key detail from the sort rules:
- Blank cells are always placed last.
- A truly blank cell is different from a cell containing spaces.
So if the “blank” entries moved to the bottom but Invoice and Payment still look mixed, the strongest explanation is inconsistent cell contents such as leading/trailing spaces, or a partial sort range rather than too many rows.
References:
- Sort data in a workbook in the browser
- Sort data in a range or table in Excel | Microsoft Support
- [Windows](https://support.microsoft.com/excel/sort-data-in-a-range-or-table-in-excel#learn-more-about-general-issues-with-sorting)
- [Windows](https://support.microsoft.com/excel/sort-data-in-a-range-or-table-in-excel#sort-numbers)
- how do I sort rows in Excel when one column is blank - Microsoft Q&A