How to Fix INDEX-XMATCH Results After Sorting an Excel Table in WPS Office
Question details
The user needs to correct an INDEX-XMATCH formula that returns mismatched results after sorting an Excel table by a column other than the formula column.

- Product
- WPS Office Spreadsheets
- Device & OS
- not provided
- Scenario
- The user has an Excel table with an INDEX-XMATCH lookup formula and needs to sort the table by different columns while keeping formula results aligned with the correct rows.
- Observed behavior
- After sorting the table, the INDEX-XMATCH formula returns mismatched results because the formula includes an external worksheet qualifier such as 'Entry-by-line'!, which prevents references from following the correct table row.
Open the workbook in WPS Office Spreadsheets and confirm that the INDEX-XMATCH formula contains an external worksheet reference such as 'Entry-by-line'!. Make sure the data range is formatted as an Excel table with built-in filter headers.
Remove the worksheet qualifier and sort the Excel table using its built-in headers
Use this method when an INDEX-XMATCH formula references a table through an external worksheet qualifier and returns mismatched results after sorting.
When a formula includes an external sheet qualifier such as 'Entry-by-line'!, WPS Office Spreadsheets may keep the reference tied to a fixed worksheet position instead of the table row. Removing the qualifier allows structured or relative references to follow each row, so sorting the table updates the lookup result correctly.
Click the cell that contains the INDEX-XMATCH formula returning mismatched results after sorting.
In the formula bar, delete the sheet name and exclamation mark, for example change 'Entry-by-line'!A2 to A2, or use structured references such as [@ColumnName].
Press Enter to apply the edited formula and verify that the result matches the correct row before sorting.
Click any cell in the table, open the drop-down arrow on the target column header, and choose Sort Ascending or Sort Descending as needed.

Fix INDEX-XMATCH Lookups When Sorting Excel Tables in WPS Office
Open the workbook in WPS Office Spreadsheets, remove the external worksheet qualifier from the INDEX-XMATCH formula, and use the table header sorting tools so lookup results remain row-accurate.
- 1. Open the workbook in WPS Office Spreadsheets: Launch WPS Office, click Open, and select the .xlsx workbook that contains the Excel table and INDEX-XMATCH formula.
- 2. Review the formula reference: Select the formula cell and check whether the formula contains an external sheet qualifier such as 'Entry-by-line'! before a cell or column reference.
- 3. Remove the qualifier and keep table references: Delete the sheet name and exclamation mark from the formula, leaving relative or structured references tied to the current table row.
- 4. Sort the table by a header: Click the header filter arrow in the column you want to sort by and choose Sort Ascending or Sort Descending.
- 5. Verify the lookup results: Confirm that each INDEX-XMATCH result now matches the correct row after sorting.

Frequently Asked Questions
Why does INDEX-XMATCH return wrong values after sorting an Excel table?
It usually happens when the formula contains an external worksheet qualifier such as 'Entry-by-line'!. That qualifier can keep the reference tied to a fixed worksheet position instead of the current table row, so remove it and use structured or relative references.
How do I remove the worksheet reference 'Entry-by-line'! from a formula in WPS Office?
Select the formula cell, click the formula bar, delete the sheet name and exclamation mark, and leave the cell or structured reference. Press Enter to apply the change.
Can I sort an Excel table without changing INDEX-XMATCH formulas?
Yes. Use the built-in sort arrows on the table headers. The formulas must not contain a fixed external sheet qualifier; structured references such as [@ColumnName] follow the row automatically.
Does WPS Office support INDEX and XMATCH in Microsoft Excel files?
Yes. WPS Office Spreadsheets supports INDEX, XMATCH, table formulas, and .xlsx workbooks, so you can edit and sort these files without conversion.
What should I do if the INDEX-XMATCH result is still wrong after removing the sheet reference?
Make sure the data range is formatted as an actual table and use consistent structured references. Check that the lookup array and return array cover the same row positions and that the sort was applied from the table header drop-down.




