Setting up a lookup table in Excel means building a small, organized table of values and then pulling answers from it automatically with a function like VLOOKUP, XLOOKUP or INDEX/MATCH. Once it's in place, you type a key (such as a product code or name) and Excel returns the matching value, such as a price or category, without any manual searching. All you need is Excel itself and a few minutes.
What You'll Need
- Excel on Windows, Mac, or Excel for the web (menu names can differ slightly by version)
- A list of data with a unique identifier in the first column, such as a product code or employee ID
- A separate cell or range where you want the looked-up results to appear
Step-by-Step
- Organize your source data. Put your lookup table on its own sheet or a clear area of a sheet. The identifier you'll search by (product code, name, ID) must be in the first column, with the values you want to return (price, category, etc.) in the columns to its right. Each identifier should appear only once.
- Convert the range to an official Excel Table. Click any cell inside your data, then press Ctrl+T (Cmd+T on Mac) or go to Insert > Table. Confirm the range and tick the box if your data has headers. Tables auto-expand when you add rows, so your lookup keeps working as the list grows.
- Name the table (optional but helpful). With the table selected, type a name like Products in the Table Name box under Table Design (Table tab on Mac). This makes formulas easier to read and immune to row insertions.
- Choose your lookup function. In current Excel versions use XLOOKUP; it works in any direction and handles missing values cleanly. If your Excel doesn't have XLOOKUP, use VLOOKUP (identifier must be in the first column) or INDEX/MATCH.
- Enter the formula. Click the cell where you want the result and type one of these, adjusting ranges to match your data:
- XLOOKUP:
=XLOOKUP(A2, Products[Code], Products[Price], "Not found") - VLOOKUP:
=VLOOKUP(A2, Products, 2, FALSE)(the 2 means return the 2nd column of the table) - INDEX/MATCH:
=INDEX(Products[Price], MATCH(A2, Products[Code], 0))
- XLOOKUP:
- Lock the range if you used cell references. If you wrote the lookup range as plain cells like B2:D50 instead of a table, press F4 after selecting it to make it absolute ($B$2:$D$50) so it doesn't shift when copied.
- Copy the formula down. Drag the fill handle (the small square at the bottom-right of the cell) down alongside your list of lookup values. Each row now pulls its own result.
- Handle errors. Wrap VLOOKUP or INDEX/MATCH in IFERROR to show a friendly message instead of #N/A:
=IFERROR(VLOOKUP(A2, Products, 2, FALSE), "Not found"). XLOOKUP's fourth argument already does this. - Test it. Change one lookup value to something that isn't in the table and confirm you get your "Not found" message. Then restore it.
Common Mistakes
- Forgetting FALSE in VLOOKUP. Omitting the fourth argument makes VLOOKUP do an approximate match, which returns wrong answers on unsorted data. Always use FALSE for exact matches.
- Extra spaces or mismatched formatting. "Apple " won't match "Apple", and a number stored as text won't match a real number. Use TRIM to remove stray spaces, or reformat the cells so both sides match.
- Duplicate identifiers. If a code appears twice, the lookup only ever returns the first match, which may be the wrong one.
- Not locking the range. Copying a formula with a relative range like B2:D50 shifts the range on each row and eventually looks in the wrong place.
- Inserting columns after building VLOOKUP. VLOOKUP counts columns by number, so adding a column can silently change which value is returned. XLOOKUP or INDEX/MATCH avoid this.
Tips
- Prefer XLOOKUP if your version has it; it's simpler and more robust than VLOOKUP.
- Using a named Excel Table (steps 2–3) means you never have to fix ranges when data grows or moves.
- For approximate matches, such as tax brackets or commission tiers, sort the lookup column ascending and use the approximate-match option deliberately.
- Freeze the header row of your lookup sheet (View > Freeze Panes > Freeze Top Row) so it stays visible while you check entries.
- Data validation (Data > Data Validation) can create a dropdown of valid identifiers, preventing typos before they cause #N/A errors.
Troubleshooting
- #N/A error: the lookup value genuinely isn't found. Check for extra spaces, number-vs-text formatting, and that the value exists in the table's first (or specified) column.
- #REF! error: the formula points to a deleted column or row outside the table. Rebuild the range reference or table name.
- #VALUE! error: usually a mismatch in the arguments, such as swapping the lookup range and return range in XLOOKUP. Check that both ranges are the same size and correctly ordered.
- Wrong values returned: you're likely getting an approximate match (missing FALSE), or the range shifted because it wasn't locked or converted to a table. Fix those first.
- XLOOKUP shows as #NAME?: your Excel version doesn't support XLOOKUP. Use VLOOKUP or INDEX/MATCH instead.
- Formula returns the same result on every row: calculation may be set to manual. Go to Formulas > Calculation Options and choose Automatic, then press F9.
Frequently Asked Questions
What's the difference between VLOOKUP and XLOOKUP?
XLOOKUP is the newer function: it can look in any direction, returns an exact match by default, and lets you specify a custom "not found" message. VLOOKUP only searches the first column of the range, needs FALSE for exact matches, and breaks if columns are inserted.
Should the lookup table be on the same sheet?
It can be, but a separate sheet keeps things tidy. Reference it with the sheet name, e.g. =VLOOKUP(A2, Sheet2!A2:D50, 3, FALSE), or better, use a named table and skip the sheet reference entirely.
Can I return multiple columns at once?
Yes. XLOOKUP can return a whole row if you give it a multi-column return range, spilling the results across adjacent cells. With VLOOKUP you need one formula per column, changing the column index number in each.
Can I do a case-sensitive lookup?
Standard lookup functions are not case-sensitive. For case-sensitive matching, use an array formula combining INDEX and MATCH with the EXACT function, for example =INDEX(B2:B10, MATCH(TRUE, EXACT(A2, A2:A10), 0)).
Why does my lookup work for some rows but not others?
Almost always a data issue: trailing spaces, mixed number/text formats, or inconsistent spelling. Run TRIM on both sides, or check with =A2=D5 style comparisons to find exactly which values fail to match.