Excel's relationship functions—XLOOKUP, VLOOKUP, INDEX/MATCH, and their relatives—let you pull data from one table into another based on a shared key, so you can build reports, dashboards, and checklists without copying and pasting. The core idea is simple: you give Excel a value to find, a column or range to search, and a column or range to return. This guide walks through the most reliable modern approach (XLOOKUP), the classic fallback (INDEX/MATCH), and the older VLOOKUP, with the exact syntax, common pitfalls, and fixes. You do not need add-ins or macros; everything here works in Excel for Microsoft 365, Excel 2021, and Excel 2019 (XLOOKUP requires Microsoft 365 or Excel 2021 and later; if you are on an older version, use INDEX/MATCH).
What You'll Need
- A version of Excel that supports the function you plan to use: XLOOKUP is in Microsoft 365 and Excel 2021+; INDEX/MATCH works in all modern versions; VLOOKUP works everywhere but is less flexible.
- Two data ranges: a source table (where the answer lives) and a lookup table (where you type the formula). Both must share at least one common column or key, such as an ID, SKU, email, or date.
- Clean keys: no leading/trailing spaces, consistent capitalization, and matching data types (text vs. number). Excel treats "123" and 123 as different values.
- Optional: an Excel Table (select your range, press Ctrl+T) so ranges expand automatically when you add rows.
Step-by-Step
- Identify your key column. In both tables, find the column that uniquely identifies each row—for example, Product ID in a price list and Product ID in an order sheet. The key must be unique in the lookup table; duplicates cause Excel to return the first match only.
- Decide which function fits. Use XLOOKUP if available: it searches in any direction, handles missing values gracefully, and does not break when columns are inserted. Use INDEX/MATCH if you are on an older version or need maximum compatibility. Use VLOOKUP only for simple left-to-right lookups where the return column is to the right of the key.
- Write an XLOOKUP formula. Click the cell where you want the result and type:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found]). For example, to find the price of the product ID in cell A2:=XLOOKUP(A2, Products[ID], Products[Price], "Not found"). Press Enter. The fourth argument is optional but recommended so you see a clear message instead of #N/A when a key is missing. - Write an INDEX/MATCH formula (older versions). Type:
=INDEX(return_range, MATCH(lookup_value, lookup_range, 0)). Example:=INDEX(Products[Price], MATCH(A2, Products[ID], 0)). The 0 in MATCH means exact match—always use 0 for lookups unless you deliberately want an approximate match on sorted data. - Write a VLOOKUP formula (simple cases). Type:
=VLOOKUP(lookup_value, table_array, col_index_num, FALSE). Example:=VLOOKUP(A2, Products!A:D, 4, FALSE). The FALSE (or 0) forces an exact match. The column number counts from the first column of the range, so if your range starts at column A and the price is in column D, use 4. - Fill the formula down. Drag the fill handle or double-click it. If you used an Excel Table, structured references like
Products[ID]adjust automatically; if you used plain ranges, lock them with dollar signs (e.g.,$A$2:$D$100) before filling so the range does not shift. - Check a few results manually. Pick three rows and verify the returned values against the source table. This catches reversed ranges, wrong column numbers, and type mismatches early.
- Handle errors deliberately. Wrap the formula in IFERROR if you want a blank or custom message:
=IFERROR(XLOOKUP(...), ""). For XLOOKUP, prefer the built-in if_not_found argument instead of IFERROR so genuine formula errors are not hidden. - Convert to values if needed. If you will delete the source table or share the file with someone who lacks the function, copy the results and use Paste Special > Values to freeze them.
Common Mistakes
- Mismatched data types. A number stored as text (often imported from CSV) will not match a real number. Fix with Text to Columns or by multiplying by 1, or use VALUE() inside the formula.
- Hidden spaces. Trailing spaces in keys cause #N/A. Clean with TRIM() or Find & Replace (find a space, replace with nothing) after selecting the column.
- Relative ranges that shift. Forgetting dollar signs before filling down makes the lookup range move and return wrong answers.
- VLOOKUP column count errors. Inserting a column inside the table range changes the column index and silently returns the wrong field. XLOOKUP and INDEX/MATCH avoid this.
- Duplicate keys. If the lookup table has two rows with the same ID, Excel returns only the first. Deduplicate or use a helper column to make keys unique.
- Approximate match by accident. Omitting the fourth argument in VLOOKUP defaults to TRUE (approximate), which returns wrong values on unsorted data. Always type FALSE.
Tips
- Use Excel Tables (Ctrl+T) and structured references so formulas read clearly and expand with new rows.
- Name your key columns consistently across sheets; a column called "ID" in one table and "Product_ID" in another is fine as long as you reference the right one.
- For multiple criteria, XLOOKUP supports concatenated keys:
=XLOOKUP(A2&B2, Table1[ID]&Table1[Region], Table1[Value])entered as a normal formula in Microsoft 365. - Test with a known missing key to confirm your if_not_found message works.
- Keep a small "test" sheet with three or four rows so you can verify formulas before applying them to thousands of rows.
Troubleshooting
If you see #N/A, the key was not found. Check for spaces, case differences (XLOOKUP is case-insensitive by default; use EXACT inside for case-sensitive matching), and number-vs-text mismatches. If you see #REF!, the return range is invalid—often because the source sheet was deleted or the range was moved. If you see #VALUE!, an argument is the wrong type, such as a range where a single value is expected. If results are wrong but not errors, verify the column index in VLOOKUP, confirm the ranges are absolute, and check that the lookup table has no duplicates. If XLOOKUP returns a spilled array error (#SPILL!), the cells below or to the right are not empty; clear them or move the formula. If the function name is not recognized, your Excel version does not support it—switch to INDEX/MATCH. Finally, if formulas work on one sheet but not another, compare the cell formats: a column formatted as Text will store numbers as text and break matching.
Frequently Asked Questions
What is the difference between XLOOKUP and VLOOKUP?
XLOOKUP can search left or right, returns a range instead of a column number, has a built-in not-found argument, and defaults to exact match. VLOOKUP only searches to the right of the key, uses a column index that breaks when columns are inserted, and defaults to approximate match unless you specify FALSE.
Can I use relationship functions across different workbooks?
Yes, but both workbooks must be open when the formula calculates, and the external reference includes the file path. If the source workbook moves or is renamed, the formula returns #REF!. For stability, keep both tables in the same workbook or paste values.
Why does my lookup return the wrong row?
The most common causes are duplicate keys in the lookup table (Excel returns the first match), a relative range that shifted when filled, or an approximate match in VLOOKUP. Check these three first.
How do I look up with two criteria?
In Microsoft 365, concatenate the criteria and the key columns inside XLOOKUP: =XLOOKUP(A2&B2, Table1[ID]&Table1[Region], Table1[Value]). In older versions, use INDEX/MATCH with an array formula or a helper column that combines the keys.
Does XLOOKUP work in Excel 2019?
No. XLOOKUP was introduced in Excel 2021 and Microsoft 365. In Excel 2019 and earlier, use INDEX/MATCH, which provides the same left-or-right flexibility.
Can I return multiple columns at once?
Yes, with XLOOKUP: set the return_array to a multi-column range, and the results spill into adjacent columns. INDEX/MATCH returns one column at a time unless you combine it with other functions.