Joining Data in Excel Without Forgetting: VLOOKUP, HLOOKUP, INDEX, MATCH, and XLOOKUP
Good evening everyone! Tonight in my free time, I was reviewing how I join and combine tables across different tools—specifically why writing a LEFT JOIN in SQL or pd.merge() in pandas feels completely natural, while doing the exact same lookup in Excel always makes me pause and second-guess the argument order.
When you spend most of your time working with relational tables or DataFrames, you think in set-based operations: take Table A, take Table B, match them on a key column, and produce a new table in one shot. Excel flips that mental model upside down. Instead of merging two tables at once, Excel forces you to stand inside one single cell, send a formula over to another table to fetch one value, and then drag that formula down across all your rows.
To make sure this sticks for good, I built an interactive, self-grading practice workbook using the classic Sample - Superstore dataset (Orders, People, Returns, Shipping_Table, Discount_Matrix, and Commission_Rules):
- Open the Live Google Sheets Exercise Workbook: Excel & Sheets Lookup Mastery (Superstore) (Tip: Click File → Make a copy so you have your own private copy where the
Auto-Checkcolumn turns green as you solve each prompt!)
Since I need to record a lot of stuff so I can remember it properly, here are the 5 core lookup functions, a visual decision map, and 15 hands-on exercises you can practice right inside that spreadsheet.
1. VLOOKUP: Vertical Scan, Right-Only Pull 🔍
VLOOKUP stands for Vertical Lookup. It scans down the leftmost column of a table until it finds an exact match for your lookup key, then slides to the right on that same row to return a value from a specific column number.
Extra Example: Think of a printed language dictionary or a university exam roster sorted by Student ID on the far left. You run your finger down the left column until you find your ID, then slide straight across to the right to read your grade. You can never read backward to the left of the ID column.
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
lookup_value: What you are searching for (e.g.,'1_Dataset'!C2, which holds"South").table_array: The lookup range where your key must sit in the very first column (e.g.,'1_Dataset'!$I$1:$J$5).col_index_num: Which column inside that highlighted box holds your answer (1=Region,2=Regional_Manager).[range_lookup]: Always passFALSE(or0) for an exact match (SQL =). Leaving this blank defaults toTRUE(approximate match), which silently returns wrong rows on unsorted keys.
=VLOOKUP('1_Dataset'!C2, '1_Dataset'!$I$1:$J$5, 2, FALSE)
2. HLOOKUP: VLOOKUP Tipped on Its Side ↔️
HLOOKUP stands for Horizontal Lookup. Instead of scanning down a leftmost column, it scans across the very top row from left to right and drops downward by a row index number.
Extra Example: Picture a university lecture timetable where the days of the week (Monday, Tuesday, Wednesday) run across the top header row, and the course times stack downward underneath each day.
=HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
=HLOOKUP('1_Dataset'!D2, '1_Dataset'!$B$14:$E$16, 2, FALSE)
3. MATCH: The 1-Based Position Finder 🧭
MATCH does not return text or prices—it only returns an integer position (1, 2, 3...) telling you where an item lives inside a single 1D row or column. In Python/pandas terms, it is the 1-indexed equivalent of list.index(key) + 1.
Extra Example: Imagine searching a library catalog computer for a textbook title. The screen does not hand you the physical book—it simply outputs “Shelf #3.”
=MATCH(lookup_value, lookup_array, [match_type])
lookup_array: Must be a single 1D strip (one column like$I$2:$I$5or one row like$B$19:$E$19).[match_type]:0for exact match;1for largest value $\le$lookup_value(ascending brackets);-1for smallest value $\ge$lookup_value(descending brackets).
=MATCH("Central", '1_Dataset'!$I$2:$I$5, 0)
(In I2:I5, "West" is 1, "East" is 2, and "Central" is 3.)
4. INDEX + MATCH: Breaking the Left-Lookup Barrier 🧩
INDEX is the exact opposite of MATCH: you hand INDEX a grid and a (row_num, column_num) coordinate, and it returns whatever value sits at that intersection—just like df.iloc[row - 1, col - 1].
When you nest MATCH inside INDEX, MATCH finds the row coordinate dynamically while INDEX pulls the answer from any column—including columns to the left of your lookup key!
=INDEX(return_column, MATCH(lookup_value, key_column, 0))
In our People table (H1:J5), Manager_Code (H) sits to the left of Region (I). VLOOKUP fails here, whereas INDEX + MATCH handles it cleanly:
=INDEX('1_Dataset'!$H$2:$H$5, MATCH('1_Dataset'!C6, '1_Dataset'!$I$2:$I$5, 0))
Even better, if someone inserts new columns between H and I, Excel updates both range references automatically instead of breaking a hardcoded column index.
5. XLOOKUP: The Modern All-in-One Replacement 👑
Available in Excel 365, Excel 2021+, and Google Sheets, XLOOKUP replaces VLOOKUP, HLOOKUP, and basic INDEX + MATCH with a single, clean syntax. Instead of counting columns, you point independently at your search column and your answer column.
“Simplicity is about subtracting the obvious and adding the meaningful.” – John Maeda
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Why XLOOKUP feels closest to pd.merge(..., how="left").fillna():
- Exact match by default:
match_modedefaults to0—no more forgetting, FALSE. - Built-in null handling: The 4th argument
[if_not_found]replaces#N/Acleanly without wrapping everything inIFERROR(). - Reverse search (
search_mode = -1): Scans from bottom to top so you can grab the latest transaction for a customer or region in one step.
=XLOOKUP('1_Dataset'!A2, '1_Dataset'!$H$9:$H$11, '1_Dataset'!$I$9:$I$11, "No")
Quick Side-by-Side Comparison
| Feature | VLOOKUP | HLOOKUP | INDEX + MATCH | XLOOKUP |
|---|---|---|---|---|
| Direction | Vertical only | Horizontal only | Any (1D or 2D) | Any (1D or 2D) |
| Look Left / Up? | No | No | Yes | Yes |
| Exact Match Default? | No (FALSE required) |
No (FALSE required) |
No (0 required) |
Yes (0 default) |
| Survives Column Inserts? | No | No | Yes | Yes |
| Built-in Fallback? | No | No | No | Yes ([if_not_found]) |
6. Practice Arena: 15 Exercises on the Superstore Google Sheet 🏋️♂️
Open the 2_Exercises tab in the Superstore Google Sheets Workbook, make a copy to your Drive, and type your formulas into Column E. Column G will automatically verify your output!
| # | Focus | Exercise Prompt (Referencing '1_Dataset') |
Expected Result |
|---|---|---|---|
| 1 | VLOOKUP (Right) |
Pull Regional_Manager for Order row 2 ('1_Dataset'!C2) from People ('1_Dataset'!$I$1:$J$5). |
Cassandra Brandow |
| 2 | VLOOKUP (Flag) |
Check if Order row 4 ('1_Dataset'!A4) appears in Returns ('1_Dataset'!$H$8:$I$11). |
Yes |
| 3 | HLOOKUP (Exact) |
Get Est_Days for Order row 3 Category ('1_Dataset'!D3) from Shipping_Table ('1_Dataset'!$B$14:$E$16). |
2 |
| 4 | HLOOKUP (Exact) |
Get Handling_Fee for Order row 5 Category ('1_Dataset'!D5) from Shipping_Table ('1_Dataset'!$B$14:$E$16). |
15 |
| 5 | MATCH (1D Index) |
Find the relative row position of "Central" inside '1_Dataset'!$I$2:$I$5. |
3 |
| 6 | INDEX (2D Grid) |
Use pure INDEX on '1_Dataset'!$H$2:$J$5 (no MATCH) to pull "Chuck Magee". |
Chuck Magee |
| 7 | INDEX + MATCH (Left) |
Look left: Get Manager_Code ('1_Dataset'!$H$2:$H$5) for Order row 6 Region ('1_Dataset'!C6). |
MGR-03 |
| 8 | INDEX + 2 MATCHes |
2D Exact: Get Discount % from '1_Dataset'!$B$20:$E$23 for Order row 4 (Region C4, Qty F4). |
12% |
| 9 | XLOOKUP (Left) |
Rewrite #7 using XLOOKUP: Get Manager_Code for Order row 6 Region ('1_Dataset'!C6). |
MGR-03 |
| 10 | XLOOKUP (Fallback) |
Check Returns ('1_Dataset'!$H$9:$I$11) for Order row 2 ('1_Dataset'!A2); return "No" if missing. |
No |
| 11 | XLOOKUP (Reverse) |
Search bottom-to-top (search_mode = -1) to find the last "West" Order_ID in '1_Dataset'!$A$2:$C$11. |
CA-2024-167164 |
| 12 | XLOOKUP (Wildcard) |
Use match_mode = 2 to find Customer_Name whose Order_ID ends with "161389". |
Irene Maddox |
| 13 | 2D Approx MATCH |
Get Discount % for Order row 5 (Region C5 = "West", Qty F5 = 6) using bracket match (1) on Qty headers. |
10% |
| 14 | XLOOKUP (Bracket) |
Find South’s discount ('1_Dataset'!$B$22:$E$22) for Qty = 8 using match_mode = -1 (next smaller). |
12% |
| 15 | Composite Key Join | Join Order row 2 on both Region (C2) & Category (D2) against Commission_Rules ('1_Dataset'!$G$20:$I$24). |
8% |
Complete Formula Solutions (3_Answer_Key)
=VLOOKUP('1_Dataset'!C2, '1_Dataset'!$I$1:$J$5, 2, FALSE)=VLOOKUP('1_Dataset'!A4, '1_Dataset'!$H$8:$I$11, 2, FALSE)=HLOOKUP('1_Dataset'!D3, '1_Dataset'!$B$14:$E$16, 3, FALSE)=HLOOKUP('1_Dataset'!D5, '1_Dataset'!$B$14:$E$16, 2, FALSE)=MATCH("Central", '1_Dataset'!$I$2:$I$5, 0)=INDEX('1_Dataset'!$H$2:$J$5, 2, 3)=INDEX('1_Dataset'!$H$2:$H$5, MATCH('1_Dataset'!C6, '1_Dataset'!$I$2:$I$5, 0))=INDEX('1_Dataset'!$B$20:$E$23, MATCH('1_Dataset'!C4, '1_Dataset'!$A$20:$A$23, 0), MATCH('1_Dataset'!F4, '1_Dataset'!$B$19:$E$19, 0))=XLOOKUP('1_Dataset'!C6, '1_Dataset'!$I$2:$I$5, '1_Dataset'!$H$2:$H$5)=XLOOKUP('1_Dataset'!A2, '1_Dataset'!$H$9:$H$11, '1_Dataset'!$I$9:$I$11, "No")=XLOOKUP("West", '1_Dataset'!$C$2:$C$11, '1_Dataset'!$A$2:$A$11, "None", 0, -1)=XLOOKUP("*161389", '1_Dataset'!$A$2:$A$11, '1_Dataset'!$B$2:$B$11, "Not Found", 2)=INDEX('1_Dataset'!$B$20:$E$23, MATCH('1_Dataset'!C5, '1_Dataset'!$A$20:$A$23, 0), MATCH('1_Dataset'!F5, '1_Dataset'!$B$19:$E$19, 1))=XLOOKUP(8, '1_Dataset'!$B$19:$E$19, '1_Dataset'!$B$22:$E$22, 0, -1)=ARRAYFORMULA(XLOOKUP('1_Dataset'!C2&"|"&'1_Dataset'!D2, '1_Dataset'!$G$20:$G$24&"|"&'1_Dataset'!$H$20:$H$24, '1_Dataset'!$I$20:$I$24, 0))
Conclusion: Make a Copy and Solve All 15 Rows Today
Reading syntax rules once never sticks—especially when you already have SQL and pandas at your fingertips. Open the Superstore Google Sheets Exercise, click File → Make a copy, and clear all 15 rows on the 2_Exercises tab without peeking at 3_Answer_Key. Once you master XLOOKUP and INDEX + MATCH on real data, you will never get tripped up by an Excel join again.
That’s all for today, folks! Thanks for reading. I’ll catch you in the next post.
“Tell me and I forget, teach me and I may remember, involve me and I learn.” – Benjamin Franklin
Read next
-
Related
Intermediate SQL 4 : Advanced SQL Joins and UNION — WHERE vs. ON, Multi-Key Joins, Self Joins, and Stacking Tables: A Practical ReferenceReady to level up past basic joins? In this post, we untangle the subtle difference between filtering in WHERE vs. ON, use comparison operators and...
-
Related
Intermediate SQL 3 : SQL Joins Explained — INNER, LEFT, RIGHT, and FULL OUTER: A Practical ReferenceTime to connect the dots across multiple tables! In this post, we break down how relational joins work under the hood and walk through INNER, LEFT,...
-
Related
Intermediate SQL 2 : SQL Aggregate Functions and DISTINCT: A Practical ReferenceMoving from raw rows to real summaries! In this post, we break down COUNT, SUM, MIN, MAX, AVG, and DISTINCT using our Apple (AAPL) stock dataset—in...
-
Related
Intermediate SQL 6 : Advanced Query Architecture — Subqueries, Window Functions, Query Performance Tuning, and SQL Pivoting: A Practical ReferenceComplete the SQL analytics toolkit by mastering multi-stage subqueries, row-retaining window functions (ROW_NUMBER, RANK, NTILE, LAG/LEAD), executi...
-
Related
Intermediate SQL 5 : SQL Data Cleaning & Wrangling — Data Types, Date/Time Formatting, and String Manipulation: A Practical ReferenceBridge the gap between messy CSV/Excel imports and analysis-ready tables by mastering SQL data types, CAST/:: conversions, ISO date arithmetic, str...
-
Reader favourite
Dota 2 Patch 7.42 : Item Potency, 15-Minute Tormentors, and Day 1 Meta ShiftsDota 2 Patch 7.42 kills passive high-ground stalling, nerfs spell burst, and adds Item Potency. Here is a full breakdown plus Day 1 pick and win ra...
-
Reader favourite
How to Research Anything (Even When You Have a Full-Time Job)You don't need a PhD or endless free time to do deep research. Here is a practical system to scope questions, filter sources, and actually finish w...
-
Reader favourite
Predicting BBRI Stocks with Meta’s ProphetThe IHSG so shit recently not gonna lie/ Have you ever wondered how businesses predict future sales, how weather apps forecast the temperature, or ...
Leave a comment