Function Problems

How to Match Monthly Excel Data When Sort Order Changes

Anum MushtaqAnum Mushtaq Nov 11, 2026 868 views

Question details

The user needs to retrieve specific monthly data for a person or item from a previous worksheet where the sort order of rows is different from the current sheet.

Match Monthly Excel Data When Sort Order Changes
Product
Excel
Device & OS
not provided
Scenario
Comparing or aggregating monthly sales data across different worksheets where the list of salespeople is sorted differently each month.
Observed behavior
Direct cell references (e.g., =July!B5) return data for the wrong person because the row positions change from month to month.
Before you start

Ensure that the unique identifiers (like the salespeople's names) are spelled identically on both worksheets without extra trailing spaces to avoid mismatch errors.

Solution 1Recommended

Use the XLOOKUP Function

Use the modern XLOOKUP function to dynamically search for a name and return its corresponding value, regardless of the row's position on the previous month's sheet.

A direct reference simply looks at a specific cell position. If the list is sorted differently, that position holds someone else's data. XLOOKUP searches the entire column for the specific name, ensuring accurate data retrieval.

1
Select the destination cell

Click on the cell in your current month's worksheet where you want the previous month's total to appear.

2
Enter the XLOOKUP formula

Type the formula: =XLOOKUP(A5, July!A:A, July!BP:BP, ""). In this example, A5 is the salesperson's name on the current sheet, July!A:A is the column containing names on the previous sheet, and July!BP:BP is the column containing the totals you want to pull.

3
Apply to the remaining rows

Press Enter to see the result. Click the fill handle in the bottom-right corner of the cell and drag it down to apply the formula to the rest of the salespeople.

Use the XLOOKUP Function
Formula Customization: Be sure to replace 'July' with the exact name of your previous month's worksheet, and update the column references (A:A and BP:BP) to match your actual data layout.
Easily Match Data with WPS Spreadsheet

Match Data Across Worksheets Seamlessly in WPS Office

WPS Spreadsheet fully supports advanced lookup functions like XLOOKUP, VLOOKUP, and INDEX/MATCH, allowing you to cross-reference and aggregate monthly data effortlessly regardless of sorting variations.

  1. 1. Open your monthly workbooks: Launch WPS Spreadsheet and open the file containing your differently sorted monthly data.
  2. 2. Apply the lookup formula: Select the target cell and type =XLOOKUP(...) to match your data using identical syntax to Microsoft Excel.
  3. 3. Calculate and evaluate: Press Enter to execute the formula and drag to fill the rest of the column flawlessly.
Full compatibility with Microsoft Excel formulas and file formats (.xlsx)Built-in support for advanced functions including XLOOKUP and dynamic arraysFree, lightweight, and fast processing for large datasetsIntuitive tabbed interface to easily switch between monthly worksheets
microsoft office alternative - wps office

Frequently Asked Questions

Why does my XLOOKUP formula return an #N/A error?

The #N/A error occurs when the formula cannot find an exact match. This is usually caused by spelling differences, accidental trailing spaces in the names, or the person simply not existing on the previous month's sheet.

How do I handle names that have extra spaces?

You can wrap the lookup value in the TRIM function to remove excess spaces. For example, use =XLOOKUP(TRIM(A5), July!A:A, July!BP:BP, "") to ensure a cleaner match.

Can I use INDEX and MATCH to solve this sort order problem?

Yes, INDEX and MATCH is highly reliable and compatible with all spreadsheet versions. You can use the formula =INDEX(July!BP:BP, MATCH(A5, July!A:A, 0)) to retrieve the exact same result.

What does the empty string ("") do at the end of the XLOOKUP formula?

The empty string ("") is the optional 'if_not_found' argument in XLOOKUP. It tells the formula to return a blank cell instead of an #N/A error if the salesperson is not found in the previous month's data.