How to Match and Reorder Excel Data from One Column to Another
Question details
The user needs to align misordered data in two columns so that the values match the sorted sequence of a master list in another column.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Reordering randomly sorted data columns to correctly align with matching identifiers (like email addresses) in a master column.
- Observed behavior
- Columns C and D contain the correct data but are physically out of order compared to the sorted master list in column B, requiring realignment so the rows match perfectly.
Before reordering your data, ensure there are no duplicate values in your master column to prevent incorrect matching and sorting behavior.
Use a Helper Column with the MATCH Function to Sort Data
This method calculates the correct row position for each item, allowing you to physically sort the misaligned columns to match your master list.
By using the MATCH function, you can determine exactly where each randomly sorted item belongs according to the master list. Once these positions are calculated, you can perform a standard sort to reorder the physical data.
In an empty column next to your misaligned data (e.g., cell E2), enter the formula `=MATCH(C2,$B$2:$B$1000,0)`. Adjust the range `$B$2:$B$1000` to cover the exact length of your master list in Column B.
Click cell E2, grab the fill handle in the bottom-right corner, and drag it down to apply this formula to all rows containing data in columns C and D.
Select the entire helper column (Column E) and press Ctrl+C to copy. Right-click the selected area and choose 'Paste as Values' (the clipboard icon with 123) to convert the formulas into static numbers.
Select columns C, D, and E together. Navigate to the Data tab on the ribbon, click 'Sort', and choose to sort by your helper column (Column E) in Ascending order.
Check that the data in columns C and D now perfectly aligns row-by-row with column B. Once verified, you can safely delete the helper column E.

Use XLOOKUP to Pull Data without Physical Sorting
If you prefer to leave the original random data untouched, use XLOOKUP to pull the related information directly into a new column aligned with your master list.
Reorder and Match Data Effortlessly in WPS Spreadsheet
WPS Spreadsheet provides powerful and familiar functions like MATCH, VLOOKUP, and XLOOKUP to help you organize, align, and analyze your data seamlessly. It processes complex formulas quickly and provides an intuitive sorting interface.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the misaligned columns.
- 2. Insert the MATCH formula: Create a new helper column and use the `=MATCH()` formula to identify the correct row sequence based on your master column.
- 3. Paste values and select data: Copy the formula results and paste them as values, then highlight the columns you wish to reorder.
- 4. Sort to align data: Go to the Data tab, click 'Sort', and sort ascending by your helper column to perfectly align your data.

Frequently Asked Questions
Why is my MATCH formula returning #N/A errors when aligning data?
A #N/A error means the exact value was not found in the lookup array. This frequently happens due to trailing spaces, invisible characters, or spelling differences. It can also occur if you forgot to lock your lookup range with absolute references (like $B$2:$B$1000).
Can I use VLOOKUP instead of XLOOKUP to align this data?
Yes, but only if the matching identifier (like the email address) is located in the leftmost column of your randomly ordered data table. If the identifier is situated to the right of the notes you are trying to retrieve, you must use XLOOKUP or an INDEX/MATCH combination.
How do I align rows if there are duplicate values in my master column?
Standard lookup functions like MATCH, VLOOKUP, or XLOOKUP will only return the first instance of a duplicate value. To accurately handle duplicates, you either need to use Power Query to merge tables, or create a unique helper ID by combining two columns (for example, =A2&B2) before performing your match.




