Analistable

How to do an inner join in Excel

By the Analistable team · Updated · 2 min read

An inner join keeps only the rows whose key appears in both tables. In Excel, use Data → Get Data → Combine Queries → Merge, select the key in both tables and choose Inner (only matching rows). In Microsoft 365 you can also do it with a formula: FILTER the first table to keys found by XMATCH in the second, then add the second table's columns with XLOOKUP.

Part of our guide: How to join spreadsheets on a common column

What an inner join returns

Orders ⋈ Customers on Customer ID (inner)
Order IDCustomer IDAmountName
O-9001C-101120Bakery Lune
O-9002C-10375Nordic Supply
O-9003C-10180Bakery Lune

Order O-9004 (customer C-104, not in Customers) and customer C-102 (no orders) are both left out. Use a left join instead when you must keep every order — compare the result in joining two tables in Excel.

Power Query

  1. Load both tables as connections (Data → From Table/Range → Close & Load To → Only Create Connection).
  2. Data → Get Data → Combine Queries → Merge.
  3. Choose the tables, click the key column in each, and set Join Kind to Inner (only matching rows).
  4. Expand the columns you need from the second table and Close & Load.

If a key appears twice in the second table, the order appears twice in the result — that's correct join behaviour, but check whether duplicates are expected.

A formula inner join (Microsoft 365)

=LET(
  keys, Orders[Customer ID],
  hit, ISNUMBER(XMATCH(keys, Customers[Customer ID])),
  matched, FILTER(Orders, hit),
  HSTACK(matched, XLOOKUP(FILTER(keys, hit), Customers[Customer ID], Customers[Name]))
)

hit is TRUE for each order whose customer exists. FILTER keeps those orders, and XLOOKUP adds the matching name. This handles many-to-one joins (many orders per customer); for many-to-many, use Power Query.

Inner join vs other join kinds

  • Left outer: all orders, customer fields blank where missing.
  • Inner: only orders with a known customer.
  • Left anti: only orders *without* a known customer — useful for data-quality checks.

All six join kinds are explained in Power Query Merge Queries: every join kind.

Checking an inner join

Compare the row count with the left join: the difference is the number of rows that had no match. If that number is surprising, run a left anti join (or =COUNTIF(Customers[Customer ID], B2)=0 next to each order) to list the unmatched keys and look for spaces, case differences or IDs stored as numbers in one table and text in the other.

Frequently asked questions

Can Excel do an inner join?
Yes. Power Query's Merge Queries has an Inner join kind, and Microsoft 365 formulas (FILTER, XMATCH, XLOOKUP) can produce the same result.
What is the difference between an inner join and a left join?
An inner join keeps only rows that match in both tables. A left join keeps every row of the first table and fills blanks where there is no match.
Does VLOOKUP do an inner join?
Not by itself. VLOOKUP returns #N/A for missing matches; filtering those rows out afterwards gives an inner-join result for one-to-one data.

Related guides