How to merge two Excel files using a common column
Join two Excel files on a shared column such as an ID or email: with XLOOKUP, with Power Query, or in your browser with no formulas. Handles missing and duplicate keys.
Find each person's extension. There's more than one Tariq, so the first name alone isn't enough.
keyboard Typing formulas is easiest on a computer with a keyboard.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | First name | Last name | Extension | First name | Last name | Extension | ||
| 2 | Daniel | Garcia | 2541 | Tariq | Rossi | |||
| 3 | Nadia | Novak | 2170 | Nadia | Murphy | |||
| 4 | Daniel | Novak | 2317 | Tariq | Garcia | |||
| 5 | Tariq | Novak | 2632 | Daniel | Murphy | |||
| 6 | Daniel | Murphy | 2471 | Daniel | Garcia | |||
| 7 | Nadia | Murphy | 2275 | |||||
| 8 | Nadia | Rossi | 2107 | |||||
| 9 | Tariq | Rossi | 2219 | |||||
| 10 | Tariq | Garcia | 2422 | |||||
| 11 | Tariq | Murphy | 2688 | |||||
| 12 | ||||||||
| 13 | ||||||||
| 14 | ||||||||
| 15 |
When one column isn't enough to tell rows apart. Two people called Priya, or two called Patel: only the first name and the last name together point to one person. The same goes for a product and a size, or a date and a store.
Join them with & on both sides. Join the two values you are looking for, and join the two columns you search, in the same order:
=XLOOKUP(E2&F2,
$A$2:$A$11&$B$2:$B$11 builds a list of joined names (PriyaPatel, PriyaLi...) for XLOOKUP to search, without adding a column to the sheet.
It's safer: E2&" "&F2 and $A$2:$A$11&" "&$B$2:$B$11. Without one, "Ann" + "Ewing" and "Anne" + "Wing" both become AnnEwing.
INDEX and MATCH work the same way: =INDEX($C$2:$C$11,MATCH(E2&F2,$A$2:$A$11&$B$2:$B$11,0)). Before Excel 365 it had to be entered with Ctrl+Shift+Enter. Another classic fix is a helper column with =A2&B2 that VLOOKUP can search.
Join two Excel files on a shared column such as an ID or email: with XLOOKUP, with Power Query, or in your browser with no formulas. Handles missing and duplicate keys.
Know someone fighting with a spreadsheet? Send them this page.