If you want Excel rows to stay visible while you sort other data, Freeze Panes can keep header rows on screen. If instead you mean that certain records must never move during a sort, Excel does not have a ‘lock these rows in place’ sort option: keep those rows outside the sortable range or structure the data so only the intended table is sorted.
Steps
Step 1: Decide which rows are headers
Identify the header row or rows that should remain at the top while you scroll and work with the data.
Step 2: Freeze the top row if appropriate
Open the View tab and choose Freeze Panes > Freeze Top Row when only row 1 needs to remain visible.
Step 3: Freeze multiple top rows when needed
Click the first cell in the row immediately below the rows you want to keep visible, then choose View > Freeze Panes > Freeze Panes.
Step 4: Select the actual data range before sorting
Click inside the table or select the range that should be sorted. Use Data > Sort and confirm that My data has headers is set correctly.
Step 5: Keep non-sortable notes or totals outside the data table
If a row must not change position at all, do not include it in the sortable data range. Place totals, notes, or other fixed information outside the table or use Excel’s structured table features appropriately.
What Happens Next
Freezing affects what stays visible on screen; it does not prevent a row’s data from participating in a sort. Sorting changes record order within the selected range.
Troubleshooting and Useful Details
Do not sort only one column of a multi-column dataset unless you intentionally want to break the relationship between columns. When Excel warns about adjacent data, expanding the selection is usually necessary to keep each record together. Make a backup before sorting irreplaceable data.

Matt Jacobs has been working as an IT consultant for small businesses since receiving his Master’s degree in 2003. While he still does some consulting work, his primary focus now is on creating technology support content for SupportYourTech.com.
His work can be found on many websites and focuses on topics such as Microsoft Office, Apple devices, Android devices, Photoshop, and more.