Fix Excel Sort Not Keeping All Columns Together
Question details
The user is experiencing an issue where sorting an Excel workbook does not correctly include all columns, specifically leaving behind formula columns like COUNTIFS.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to sort a large company workbook containing complex formulas across multiple columns.
- Observed behavior
- The sorting process fragments the data rows because it fails to keep the formula columns aligned with the primary data columns being sorted.
Before troubleshooting the sorting issue, verify that your dataset does not contain completely blank columns or rows, as these can break the contiguous range recognized by the software.
Manually Select the Entire Data Range
Selecting the complete dataset manually ensures that no columns separated by blanks or containing complex formulas are left behind during the sort.
Click on the top-left cell of your dataset.
Drag your cursor or use the keyboard shortcut Ctrl + Shift + Arrow Keys to highlight the entire table, making sure the columns containing the COUNTIFS formulas are included in the selection.
Navigate to the 'Data' tab on the ribbon and click 'Sort'.
Set your desired sorting criteria in the dialog box and click 'OK' to sort the entire selected range together.
Create a Dummy Workbook for Safe Troubleshooting
If company policy prevents sharing the original large workbook for external support, create a minimized dummy file to isolate and test the sorting issue.
Easily Sort Large Datasets and Keep Formula Columns Together Using WPS Office
WPS Spreadsheet provides a robust and intuitive sorting feature that handles contiguous data ranges perfectly, ensuring that your formula columns stay aligned with your sorted rows without manual range adjustments.
- 1. Open the File: Launch WPS Spreadsheet and open your existing Excel workbook.
- 2. Select the Range: Highlight your entire data table, including all columns with formulas.
- 3. Apply Custom Sort: Go to the 'Data' tab, click 'Sort', and choose your preferred sorting criteria to keep all data rows together seamlessly.

Frequently Asked Questions
Why does my spreadsheet only sort some of my columns?
Spreadsheet software relies on contiguous data to automatically select the range for sorting. If there is a completely blank row or column in your table, the automatic selection stops there, leaving the remaining columns unsorted. Manually highlighting the entire range fixes this.
Can COUNTIFS formulas break the sorting function?
Formulas themselves do not break sorting. However, if formula columns recalculate based on absolute references or are separated from the main data block by a blank column, they may not visually align correctly with the rest of the row after sorting.
How do I safely share a company workbook for troubleshooting?
You should never share sensitive company data. Instead, create a copy of the workbook, replace the real data with dummy information, and delete unnecessary sheets while keeping the problematic formula structure intact before sharing.




