Autofill Excel Data from a Changing List by ID
Question details
Populate a master worksheet with values from a pasted table by matching a stable company or account number.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user regularly pastes updated data into a separate worksheet, and the order of the records may change.
- Observed behavior
- The master worksheet should retrieve each company's matching values regardless of the pasted row order.
Place the company or account IDs in column A of both the master sheet and a sheet named Paste Here. Make sure matching IDs use the same format and are unique in the pasted data.
Use XLOOKUP when the source columns stay in the same order
Match each master-sheet ID to a source ID when rows change order but the desired value stays in a fixed column.
On the Paste Here sheet, paste the updated table with IDs in column A and the values to retrieve in column B.
On the master sheet, select B2 and enter =XLOOKUP($A2,'Paste Here'!$A:$A,'Paste Here'!$B:$B,""). The empty string returns a blank if the ID is not found.
Drag the fill handle from B2 down alongside the IDs in column A. For another source field, copy the formula to its master column and change the return range to the corresponding source column.
Paste each updated table into Paste Here with the same column layout. The formulas will find the matching IDs even if the rows move.

Match both the ID and header when source columns move
Use INDEX and MATCH when the pasted table's columns may change order but their headers remain consistent.
Match company data by ID in WPS Spreadsheets
Use INDEX and MATCH in WPS Spreadsheets to retrieve values from a pasted table by company ID and column header, even when rows or columns move.
- 1. Open the workbook: Open the Excel workbook in WPS Spreadsheets and select the sheet containing the master company IDs.
- 2. Prepare the source sheet: On a sheet named Paste Here, paste the source table with IDs in column A and field headers in row 1. Enter matching field headers on the master sheet.
- 3. Add the lookup formula: Select B2 on the master sheet and enter =INDEX('Paste Here'!$A:$Z,MATCH($A2,'Paste Here'!$A:$A,0),MATCH(B$1,'Paste Here'!$A$1:$Z$1,0)).
- 4. Fill and save: Drag the fill handle across the desired fields and down the listed IDs, then use File > Save As to save the workbook in Excel format.

Frequently Asked Questions
Will the lookup still work if the pasted rows change order?
Yes. XLOOKUP and MATCH search for the ID in the source column rather than relying on a fixed row position.
What if the source columns change order too?
Use INDEX with two MATCH functions: one for the ID and one for the header. Keep the master and source header names consistent.
Why does a matching company ID return an error?
Check that the ID exists in Paste Here column A and that both sheets use the same data type, such as text or numbers. For the two-way lookup, also check the header text.
Will new companies appear automatically on the master sheet?
These formulas retrieve data for IDs already listed on the master sheet. Enter new IDs in column A and fill the formulas down to their rows.
What happens if the pasted table contains duplicate IDs?
XLOOKUP and MATCH return the first matching ID. Make source IDs unique if each master row should correspond to one company.




