Fix Excel Sorting That Includes the Header Row
Question details
The user needs Excel to exclude the header row when sorting a data range.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user sorts a range that has a header row and wants the column labels to remain at the top.
- Observed behavior
- Excel includes the header row in the sort, even when the header option is selected.
Check that the data has one header row with a nonblank name for each column. Remove merged cells and blank rows within the data range, and make sure all related columns are included in the sort.
Convert the Data Range to an Excel Table
Use a table to explicitly identify the header row and sort the complete data set.
Select the full range, including the header row and all related columns.
Select Insert > Table, check that the displayed range is correct, and select My table has headers. Then choose OK.
Open the drop-down arrow in the column header and choose the desired sort order. The header row should remain at the top.

Check the Header Setting in the Sort Dialog
Use this method if you prefer to sort a regular range without converting it to a table.
Sort Spreadsheet Data with WPS Office
WPS Office is a free, lightweight alternative for working with spreadsheets. Its familiar interface and Excel format support make it easy to move existing workbooks into WPS Spreadsheets.

Frequently Asked Questions
Why does Excel sort my header row as data?
Excel may not identify the selected range or header row correctly. Check for blank header names, merged cells, and blank rows, then select the full range and confirm My data has headers under Data > Sort.
How do I tell Excel that my table has headers?
Select the range, choose Insert > Table, and select My table has headers before choosing OK.
Should I select just one column before sorting?
Select all related columns before using Data > Sort so that each row stays together. If Excel prompts you to expand the selection, check that it includes the full data set.
Will formatting a header row keep it out of the sort?
Formatting alone may not identify a header reliably. Use My data has headers in Data > Sort, or create a table and confirm My table has headers.




