Formula Errors

How to Fix INDEX-XMATCH Results After Sorting an Excel Table in WPS Office

Maira MehtabMaira Mehtab Nov 13, 2026 869 views

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.

How to Fix INDEX-XMATCH Results After Sorting an Excel Table in WPS Office
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the formula cell

Click the cell that contains the INDEX-XMATCH formula returning mismatched results after sorting.

2
Remove the external worksheet qualifier

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].

3
Confirm the revised formula

Press Enter to apply the edited formula and verify that the result matches the correct row before sorting.

4
Sort the Excel table

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.

Remove the worksheet qualifier and sort the Excel table using its built-in headers
Formula stays aligned: After sorting, the INDEX-XMATCH formula should follow each table row and return the expected values.
WPS Spreadsheets formula fix

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. 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. 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. 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. 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. 5. Verify the lookup results: Confirm that each INDEX-XMATCH result now matches the correct row after sorting.
Keep INDEX-XMATCH and other Excel lookup formulas working in .xlsx workbooksSort Excel tables without breaking row-level formula referencesEdit formulas in a familiar Microsoft Excel-compatible interfaceOpen and save Microsoft Excel files without conversionLightweight and free spreadsheet tools with built-in table sorting and filtering
microsoft office alternative - wps office

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.