How to Keep Student Grades Aligned When Excel Tables Are Sorted
Question details
The user needs to keep student names and grade records aligned across multiple worksheets when the source table in WPS Spreadsheets is sorted.

- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- A teacher or grade manager is sorting a student roster and wants linked grade worksheets to update without breaking row alignment.
- Observed behavior
- Simple cell links or independently sorted ranges may not keep related data aligned after sorting the source table.
Before sorting, give each student a unique ID in the source table and open all related worksheets so you can verify which cells use direct references or formulas.
Keep all student name and grade columns in the same table
Use this when you only need to sort one worksheet and can avoid maintaining parallel separate ranges.
In WPS Spreadsheets, click any cell inside the student table and press Ctrl+A to select the current range, or drag to include all columns such as Student ID, Name, and Grades.
Go to the Data tab and click Sort.
Select the column you want to sort by, set the order, and click OK. WPS sorts all selected columns together, so each student's grade stays next to their name.
Link names and grades across worksheets with a unique Student ID and lookup formulas
Use this when student data is split across multiple worksheets or you want sorting-proof links to update automatically.
Keep Student Grades Aligned with Lookup Formulas in WPS Spreadsheets
Use WPS Spreadsheets to organize student records in sortable Excel-compatible tables and retrieve grades with XLOOKUP, VLOOKUP, or INDEX and MATCH, so linked worksheets stay aligned when the source table is sorted.
- 1. Open your workbook in WPS Spreadsheets: Launch WPS Office, open the Excel workbook containing the student grade tables, or create a new spreadsheet and import the data.
- 2. Add unique Student IDs: In the source worksheet, insert a Student ID column and assign a unique value to each student in the same table as the name and grade.
- 3. Apply a lookup formula in the linked worksheet: In the sheet where you need the aligned grades, enter an XLOOKUP or VLOOKUP formula that matches the Student ID and returns the grade from the source table.
- 4. Sort the source table as a whole: Select the entire source table, click Data > Sort, choose the sort column and order, then click OK. The lookup-linked grade cells update automatically.

Frequently Asked Questions
Why do my linked grades break when I sort the Excel table?
Direct cell references or Paste Link connect cells by position, not by student. When you change the row order, those references point to the new row in the old location. Use one shared table or a lookup formula that matches Student ID instead.
Can I use VLOOKUP to keep student names and grades aligned?
Yes. Put Student ID in the first column of the lookup range, then use VLOOKUP(StudentID, SourceRange, GradeColumnNumber, FALSE). In WPS Spreadsheets, this returns the grade based on ID and remains correct after sorting.
Should I keep names and grades in the same sheet?
If you do not need cross-sheet links, yes. Keep related columns in one table and sort the whole table instead of sorting individual columns. This avoids most misalignment issues.
Does XLOOKUP work in WPS Spreadsheets?
WPS Spreadsheets supports XLOOKUP in current versions. If your version does not have it, use VLOOKUP or INDEX and MATCH for the same sort-safe lookup behavior.
What if two students have the same name?
Use a unique Student ID for each student. Lookup formulas then return the correct record even when duplicate names exist, while sorting by name remains safe.





