A lookup formula finds a value in one place and returns a related value from somewhere else. The common case is a list of product codes with prices, or employee IDs with names, where you want the matching item on another sheet or in another column. Excel has three main ways to do this: VLOOKUP, XLOOKUP and INDEX with MATCH. When they are set up correctly they give the same answer, so the choice mostly depends on which version of Excel you use and how your data is laid out.
Choose the function that fits
| Function | Available in | Can return a value left of the match column? | Notes |
|---|---|---|---|
| VLOOKUP | All versions of Excel | No | Needs a column number. Set exact match with FALSE. |
| XLOOKUP | Excel 2021 and Microsoft 365 | Yes | Exact match by default. Can show your own message when nothing matches. |
| INDEX with MATCH | All versions of Excel | Yes | Two functions combined. More typing, but very flexible. |
If XLOOKUP does not appear when you start typing it, your version does not include it.
Set up the list before you write the formula
Lookups that fail usually have a data problem rather than a formula problem. Before you write one, check the following.
- The value you are matching sits in a single column, with no merged cells in it.
- The codes match exactly. Excel treats “A100” and “A100 “ (with a trailing space) as different values.
- Numbers are stored as numbers, not text. A text number looks the same but often fails to match a true number.
- The list has one header row, and there are no blank rows in the middle of the data.
- Each lookup value appears only once. If a value appears more than once, most lookups return the first match they find.
A worked example
Suppose you have a price list on a sheet named Prices. Product codes are in column A, product names in column B and prices in column C, with data in rows 2 to 50. On your order sheet, the product code is in cell A2. Any of these formulas returns its price:
=VLOOKUP(A2, Prices!$A$2:$C$50, 3, FALSE)
=XLOOKUP(A2, Prices!$A$2:$A$50, Prices!$C$2:$C$50, "Not listed")
=INDEX(Prices!$C$2:$C$50, MATCH(A2, Prices!$A$2:$A$50, 0))
Each one asks for the price that belongs to the code in A2. The dollar signs keep the ranges fixed when you copy the formula down the column.
When the result is #N/A
#N/A means Excel did not find a match. Check the spelling of the code and any extra spaces first, then confirm the code is actually in the list. Going through the causes one at a time is faster than changing the formula at random.
Lookups in Google Sheets
VLOOKUP and INDEX with MATCH use the same syntax in Google Sheets, so the VLOOKUP and INDEX with MATCH examples above work there with the same arguments.
Choosing between them
If you have Excel 2021 or Microsoft 365, XLOOKUP is usually the simplest choice because it matches exactly by default and does not need a column number. For older versions, VLOOKUP is quick and widely understood, and INDEX with MATCH handles the cases VLOOKUP cannot. To learn VLOOKUP, start with how to use vlookup step by step. For the newer function, see how to use xlookup in excel.
Two common situations need a little extra care. For a value that sits to the left of the column you are matching on, see how to look up a value to the left in excel. For a match that depends on two columns at once, such as region and product, see lookup with two criteria in excel. And if the answer looks wrong rather than showing an error, see why does vlookup return the wrong value for the usual causes.