How to Sort Excel Data by Multiple IDs While Keeping Rows Together
Question details
The user needs to sort a spreadsheet dataset by multiple ID and value columns without separating related records, using the same multi-level sort approach available in Excel and WPS Spreadsheets.

- Product
- WPS Spreadsheets (Excel-compatible)
- Device & OS
- not provided
- Scenario
- A user has a spreadsheet dataset that contains multiple ID and value columns and needs to apply a multi-level sort so related records stay in the same row.
- Observed behavior
- The dataset needs to be sorted by multiple criteria, but sorting individual columns could separate related data.
Before sorting, confirm that the data is in a contiguous range with no completely blank rows or columns inside it, and identify which columns are your primary and secondary ID sort criteria.
Use the Data > Sort multi-level command in WPS Spreadsheets to keep rows together
Use this method when you have a full data range with multiple ID or value columns and need sorting that preserves each complete row.
The multi-level Sort dialog applies criteria from top to bottom. When the entire range is selected, WPS Spreadsheets sorts whole rows, not isolated cells.
Click and drag to select all related columns and rows, including ID and value columns. Avoid selecting a single column.
Go to the Data tab and click Sort. If prompted to expand the selection, choose Expand the selection or select the full range first.
In the Sort dialog, choose the primary ID column from the Column drop-down, set Sort On to Values, and select the required order such as A to Z or Z to A.
Click Add Level to add the next ID or value column. Set its column, Values, and order. Repeat for each additional criterion, then click OK to apply the sort.

Sort Multiple ID Columns in WPS Spreadsheets Without Splitting Rows
WPS Spreadsheets provides the same multi-level Sort dialog as Excel. Select your full data range, open Data > Sort, add a level for each ID column, and click OK; WPS applies the criteria from top to bottom while keeping each row intact.
- 1. Open your workbook in WPS Spreadsheets: Launch WPS Office and open the .xlsx or .xls file that contains the data you want to sort.
- 2. Select the full data range: Click and drag to select all ID and value columns so WPS knows to sort entire rows, not just one column.
- 3. Open Sort from the Data tab: Go to the Data tab and click Sort. In the Sort dialog, choose the primary ID column, set Sort On to Values, and choose the order.
- 4. Add levels and apply: Click Add Level for each additional ID or value column, set the desired order for each, and click OK. WPS applies the levels top to bottom and keeps related rows together.

Frequently Asked Questions
Will sorting by multiple IDs separate my rows in WPS Spreadsheets?
No, if you select the entire data range before opening Data > Sort. WPS treats each row as a record and moves all selected cells in the row together.
How do I add a second or third sort level?
In the Sort dialog, click Add Level. For each new level, choose the column from the Column drop-down, set Sort On to Values, and select the order.
Why does only one column get sorted when I use Sort?
This usually happens when you select a single column. Select the whole data range first, or when prompted, choose Expand the selection to include all related columns.
Can I sort one ID column A to Z and another value column largest to smallest?
Yes. Each sort level has its own order setting. Set the primary ID to A to Z, then add another level and set it to Largest to Smallest or Z to A as needed.
Will sorting work the same if I open the file in WPS Spreadsheets and Microsoft Excel?
Yes, the multi-level Sort dialog and .xlsx format are compatible. A multi-level sort applied in WPS Spreadsheets will keep the row structure when the file is opened in Excel.




