Lookups: XLOOKUP, INDEX/MATCH and Friends
Joining tables inside a spreadsheet reliably, handling missing matches, and understanding exact vs approximate matching.
Beginner · about 4 hours · difficulty 2/5
Learn first: Formulas and Functions That Matter
Lookups are how spreadsheets join tables: bring the customer segment into the orders sheet, the price into the order lines, the target into the actuals.
The options
- XLOOKUP (Excel 365, also in Google Sheets):
=XLOOKUP(key, lookup_col, return_col, "Not found"). Exact match by default, can search from the bottom, returns whole rows. Use this when available. - INDEX/MATCH:
=INDEX(return_col, MATCH(key, lookup_col, 0)). Works everywhere, does not break when columns are inserted, and supports two-way lookups with two MATCHes. - VLOOKUP: widely used in legacy files. Know how to read it, but note its weaknesses: it only looks right, and a hard-coded column number breaks when columns move. Always pass
FALSEfor exact matching.
Approximate matching
Approximate (sorted) matching is useful for banding: tax brackets, grade boundaries, commission tiers. Keep a small sorted threshold table and look up with match mode -1 or 1.
Checking your joins
- Are keys unique in the lookup table? Duplicates mean you silently get the first match.
- Do keys match exactly? Trailing spaces, text vs number, and case differences cause misses.
- Count how many rows returned "not found" and investigate them.
Pitfall: wrapping everything in IFERROR so missing matches look like zeros. Move on when you can join two tables, report the match rate, and explain every unmatched row.
Key concepts
- XLOOKUP
- INDEX and MATCH
- Reading VLOOKUP and HLOOKUP
- Two-way lookups
- Approximate match for banding
- Diagnosing missing matches: Spaces, types, duplicates
Mini project
Take an orders table and a separate product catalogue, bring category and unit cost into each order with XLOOKUP, compute margin, and report how many orders failed to match and why.
Check yourself
Your lookup table has two rows for the same product id. What happens to your XLOOKUP results, and how would you detect it?
Free resources
- Excel help and learning (Microsoft)
- Google Sheets function list (Google)