Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Start XLOOKUP in Excel: Step-by-Step

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

XLOOKUP is a built-in Excel function that finds a value in one range or array and returns a corresponding value from another. To start it, click the cell where you want the result, type =XLOOKUP(, then supply the lookup value, the lookup array, and the return array, separated by commas, and close the parenthesis. Press Enter to run it. XLOOKUP is available in Excel for Microsoft 365, Excel 2021 and later, and Excel for the web; it is not in Excel 2019 or older, where you use INDEX and MATCH or VLOOKUP instead.

What You'll Need

  • A version of Excel that includes XLOOKUP: Microsoft 365, Excel 2021 or later, or Excel for the web. Excel 2019 does not have it.
  • A worksheet with at least two ranges: one containing the values you want to look up, and one containing the values you want to return.
  • Basic familiarity with selecting cell ranges and typing formulas.

Step-by-Step

  1. Confirm your Excel version. Open Excel and go to File > Account (or Excel > About Excel on Mac). Look for Microsoft 365 or a 2021-or-later label. If you see Excel 2019 or earlier, XLOOKUP will not work; use INDEX and MATCH instead. Menu labels can differ slightly by version and platform.
  2. Set up your data. Put the lookup values in one column (for example, product IDs in A2:A100) and the values you want back in another column on the same rows (for example, prices in C2:C100). Keep the two ranges the same height so each row lines up.
  3. Click the result cell. Choose an empty cell where the returned value should appear, such as E2.
  4. Type the function name. Type =XLOOKUP(. As you type, Excel shows a tooltip listing the arguments in order: lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode].
  5. Enter the lookup value. Type the value you are searching for, or click the cell that holds it, for example D2. Add a comma.
  6. Enter the lookup array. Select the range that contains the values to search, for example A2:A100. Add a comma.
  7. Enter the return array. Select the range with the values you want returned, for example C2:C100. This range must be the same size as the lookup array.
  8. Optional: add a not-found message. Type a comma and then a text string in quotes, such as "Not found", so the formula shows a friendly message instead of #N/A when there is no match.
  9. Close and run it. Type ) and press Enter. The cell shows the matched value. The complete formula looks like =XLOOKUP(D2,A2:A100,C2:C100,"Not found").
  10. Fill down. Drag the fill handle from the corner of the result cell down the column, or copy the formula and paste it into the other rows. Relative references adjust automatically.

Common Mistakes

  • Mismatched range sizes. The lookup array and return array must contain the same number of rows. If one is A2:A100 and the other C2:C99, Excel returns #VALUE!.
  • Using XLOOKUP in an old Excel version. Excel 2019 and earlier show #NAME? because the function does not exist there. Check the version first.
  • Forgetting the commas. Each argument must be separated by a comma; a missing one produces a formula error dialog.
  • Text versus numbers. A lookup value stored as text (for example "1001") will not match a number stored as 1001. Convert one side so the data types agree.
  • Assuming approximate matching. By default XLOOKUP requires an exact match. If you need the closest smaller or larger value, set the match_mode argument explicitly.
  • Leaving the not-found argument blank when you expect misses. Without it, a missing value shows #N/A, which can look like a broken formula.

Tips

  • Use whole-column references like A:A and C:C only when necessary; they are simpler but can slow large workbooks.
  • Name your ranges (Formulas > Define Name) so formulas read like =XLOOKUP(D2,ProductIDs,Prices,"Not found").
  • XLOOKUP can return a whole row or column when the return array is wider than one column, which makes it useful for pulling several fields at once.
  • Use the optional search_mode argument to search from the last row upward when you want the most recent match.
  • Press F2 to edit the formula in place and see the colour-coded range outlines on the sheet.

Troubleshooting

  • #NAME? error. The function is not recognised. Confirm you are on Microsoft 365, Excel 2021 or later, or Excel for the web. In older versions, use INDEX and MATCH.
  • #N/A error. No exact match was found. Check for leading or trailing spaces, text-versus-number mismatches, and whether the lookup value exists in the lookup array. Add the not-found argument to handle misses cleanly.
  • #VALUE! error. The lookup array and return array are different sizes. Resize them so they match.
  • Wrong result returned. Confirm the return array is aligned row-for-row with the lookup array. If the data was sorted or filtered, recheck the ranges.
  • Formula shows as text. The cell may be formatted as Text. Change the format to General, then re-enter the formula.
  • If that did not work, close and reopen Excel, check for updates, and try the formula in a new blank workbook with a small test range to isolate whether the issue is the formula or the data.

Frequently Asked Questions

Is XLOOKUP available in Excel 2019?

No. XLOOKUP is available in Microsoft 365, Excel 2021 and later, and Excel for the web. Excel 2019 and earlier do not include it; use INDEX and MATCH or VLOOKUP instead.

What is the minimum number of arguments XLOOKUP needs?

Three: the lookup value, the lookup array, and the return array. The remaining arguments are optional.

Can XLOOKUP look to the left?

Yes. Unlike VLOOKUP, XLOOKUP can return values from a column to the left of the lookup column because you specify the return array directly.

Does XLOOKUP match approximately by default?

No. The default is an exact match. You can change this with the match_mode argument if you need the closest smaller or larger value.

Why does XLOOKUP return #N/A when the value is clearly there?

Usually a data-type mismatch or hidden spaces. Check that both sides are stored as the same type (text or number) and trim spaces from the source data.

Can I use XLOOKUP across different sheets or workbooks?

Yes. Reference the other sheet in the ranges, for example Sheet2!A2:A100. For another workbook, include the workbook name in square brackets; keep that workbook open or the link may break.