Most Excel tutorials treat ‘how to match data in Excel’ as a synonym for ‘how to use VLOOKUP’. That’s like teaching someone to drive by only showing them how to shift into reverse. You’ll get movement — but not where you need to go.
The Problem
You’ve got two lists: one from Finance (A1:C10), with employee IDs, names, and salaries; another from HR (E1:G8), with IDs, start dates, and departments. Your job is to add department and start date to the Finance list. Simple? Not when ID 10372 appears twice in HR — once for ‘Sarah Chen’ (Marketing) and again for ‘Sarah Chen’ (Internship, same ID, different role). And ID 10489 exists in Finance but not HR. If you blindly apply VLOOKUP, you’ll silently pull the first match — or return #N/A — and nobody will notice until payroll reconciliation fails.
| ID | Name | Salary |
|---|---|---|
| 10372 | Sarah Chen | $72,500 |
| 10489 | Marcus Lee | $64,200 |
| 10121 | Anya Patel | $89,100 |
| 10555 | Diego Mora | $55,300 |
| 10372 | Sarah Chen | $72,500 |
And here’s the HR list — note the duplicate ID and missing 10489:
| ID | Start Date | Department |
|---|---|---|
| 10372 | 2022-04-11 | Marketing |
| 10372 | 2023-09-02 | Internship |
| 10121 | 2021-06-20 | Engineering |
| 10555 | 2024-01-15 | Sales |
| 10777 | 2023-11-30 | Finance |
The Solution
We’ll use XLOOKUP — not because it’s new, but because it handles ambiguity *explicitly*. The beauty of this approach is that it forces you to decide: do you want the first match? Last? All? And if no match exists, what should appear?
- In cell D2 (next to Sarah Chen’s first row), enter:
=XLOOKUP(A2,$E$2:$E$6,$G$2:$G$6,"Not found",0,1) - That last
1tells Excel to search from bottom to top — so for ID 10372, it returns “Internship”, not “Marketing”. Change it to-1to search top-down. - For Start Date (E2), use the same formula but point to column F:
=XLOOKUP(A2,$E$2:$E$6,$F$2:$F$6,"—",0,1) - Press Ctrl+Enter to fill down without changing active cell — faster than dragging.
Now your matched result looks clean — and critically, Marcus Lee (10489) shows “Not found” instead of an error:
| ID | Name | Salary | Department | Start Date |
|---|---|---|---|---|
| 10372 | Sarah Chen | $72,500 | Internship | 2023-09-02 |
| 10489 | Marcus Lee | $64,200 | Not found | — |
| 10121 | Anya Patel | $89,100 | Engineering | 2021-06-20 |
| 10555 | Diego Mora | $55,300 | Sales | 2024-01-15 |
| 10372 | Sarah Chen | $72,500 | Internship | 2023-09-02 |
Going Further
How do I match data in Excel when the keys aren’t exact? Try TEXTBEFORE and TEXTAFTER. Say your Finance list has emails (sarah.chen@acmecorp.com) and HR uses just usernames (sarah.chen). In D2, write:=XLOOKUP(TEXTBEFORE(A2,"@"),$E$2:$E$6,$F$2:$F$6,"—")
Need all matches — not just one? Use FILTER. To list every department tied to ID 10372 from HR data:=FILTER(G2:G6,E2:E6=10372) — returns both “Marketing” and “Internship” in adjacent cells.
Here’s the counterintuitive tip: Never use MATCH/INDEX unless you need array flexibility. XLOOKUP is shorter, safer, and reads left-to-right — no more counting columns. And if you’re still typing VLOOKUP(A2,..., press Alt+M+V to open the Function Wizard and replace it instantly.
When NOT to Use This
Don’t use XLOOKUP for relational integrity checks. If you’re validating whether every Finance ID exists in HR *and* vice versa, use COUNTIFS:=COUNTIFS($E$2:$E$6,A2) in column H. A result >1 flags duplicates; 0 means missing.
Avoid matching on text fields with inconsistent spacing or case unless you wrap with TRIM(UPPER()). And never match on calculated columns without checking for floating-point rounding — e.g., =A2*0.19 might display as 12.34 but store 12.3400000000001.
If your source data lives in separate workbooks, XLOOKUP will break when closed. Use Power Query instead — it caches and refreshes cleanly.
Keyboard Shortcuts
| Action | Shortcut | Notes |
|---|---|---|
| Open Function Wizard | Alt+M+V | Type “XLOOKUP” and press Tab to auto-fill arguments |
| Fill Down | Ctrl+D | Works even if selection includes blank rows |
| Select Current Region | Ctrl+A (twice) | First press selects used range; second expands to full data block |
| Toggle Formula View | Ctrl+` | See all formulas at once — essential for auditing matches |