Function Problems

How to Assign the First User ID to Duplicate Names in Excel

Camila MilosovichCamila Milosovich Oct 28, 2026 869 views

Question details

The user needs to standardize duplicate records by replacing multiple different IDs assigned to the same person with the very first ID originally generated for them.

How to Assign the First User ID to Duplicate Names in Excel
Product
Excel
Device & OS
not provided
Scenario
Managing a database across multiple worksheets where users have been assigned multiple IDs over time, and entries need to be consolidated under their first assigned ID by matching first and last names.
Observed behavior
Duplicate names exist across records with different IDs instead of sharing a single, unified first User ID.
Before you start

Ensure your first and last name columns do not contain trailing spaces, as this can prevent accurate matching. It is also highly recommended to format your data ranges as Tables before using advanced lookup functions.

Solution 1Recommended

Use Power Query to Merge Data and Extract the First ID

Power Query easily handles multi-column matching and allows sorting to pick the earliest date or first occurrence of an ID.

Power Query is the most robust tool for matching two datasets based on multiple criteria without complex formulas.

1
Format Data as Tables

Convert both the original ID list and the duplicate entry list into Excel Tables by selecting the data and pressing Ctrl+T.

2
Load Tables into Power Query

Go to the Data tab and select 'From Table/Range' for both tables to load them into the Power Query Editor.

3
Merge the Queries

In Power Query, select the duplicate entries table, go to the Home tab, and click 'Merge Queries'.

4
Establish Multi-Criteria Match

Select the original ID table from the dropdown, hold Ctrl, and click the First Name and Last Name columns in both tables to match them.

5
Expand and Sort

Expand the newly merged column to extract the 'User ID' and apply an Ascending sort on the date or ID creation column to ensure the first ID is prioritized.

6
Load Data Back to Excel

Click 'Close & Load' in the Home tab to return the cleaned, unified data to a new Excel worksheet.

Use Power Query to Merge Data and Extract the First ID
Dynamic Updates: Once your Power Query connection is set up, you can simply click 'Refresh All' on the Data tab whenever new duplicate records are added.
Efficient Data Management in WPS Spreadsheet

Easily Manage Duplicate Records with WPS Spreadsheet

WPS Spreadsheet offers powerful data handling features, including advanced lookup formulas like XLOOKUP and multi-column merging, to easily consolidate duplicate records and extract unique IDs.

  1. 1. Open Your Workbook: Launch WPS Spreadsheet and open the file containing your duplicate IDs.
  2. 2. Input the Lookup Formula: Select an empty cell in your target sheet and type the XLOOKUP or INDEX/MATCH multi-criteria formula.
  3. 3. Reference the Original IDs: Select the ranges in your source sheet that contain the correct original IDs and matching name columns.
  4. 4. Apply to All Rows: Press Enter and use the fill handle to drag the formula down for all duplicate names.
Full compatibility with Microsoft Excel functions like XLOOKUP and INDEX/MATCH.Advanced Data sorting and duplicate removal features.Free, lightweight, and fast performance even with large datasets.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my lookup formula returning #N/A for identical names?

This usually happens due to hidden characters or trailing spaces in your text. Use the TRIM() function on your name columns to clean the data before attempting to match.

Can I use VLOOKUP to match both first and last names without modifying my source data?

Standard VLOOKUP only searches a single column. To use it for two criteria without modifying source data, you must rely on array formulas like INDEX and MATCH, or switch to the newer XLOOKUP function.

How does Power Query determine the 'first' ID?

Power Query reads data from top to bottom. If you sort your merged data by a date column (oldest to newest) before removing duplicates, it retains the top-most row, effectively keeping the very first ID assigned.