XLOOKUP for Dummies: Easy Step-by-Step Guide

Formulas & functions · Updated November 23, 2026

XLOOKUP is a lookup function in Excel that finds a value in one column and returns a matching value from another column, with a simple formula: =XLOOKUP(lookup_value, lookup_array, return_array). It replaces older functions like VLOOKUP and HLOOKUP, and it works in Excel 2021 and Microsoft 365 (not in older versions).

Why XLOOKUP Exists: The Problem with VLOOKUP

Before XLOOKUP, people used VLOOKUP to find data. VLOOKUP had frustrating limits: it could only search from left to right (the lookup column had to be the leftmost), it broke if you inserted or deleted columns, and it returned errors for missing values unless you nested IFERROR. XLOOKUP fixes all of that. It searches in any direction, handles missing values gracefully, and doesn’t care if you add columns in between. Microsoft introduced XLOOKUP in 2019 for Microsoft 365 and Excel 2021, and it’s now the recommended way to look up data.

How XLOOKUP Works: The Three Required Arguments

Every XLOOKUP formula needs three parts, separated by commas:

  • lookup_value – the value you’re searching for (e.g., a product ID in cell A2).
  • lookup_array – the column or row where you’re searching (e.g., A2:A100).
  • return_array – the column or row with the result you want (e.g., B2:B100).

Example: with product IDs in A2:A10 and prices in B2:B10, to find the price for the ID in D2, use =XLOOKUP(D2, A2:A10, B2:B10). If D2 contains “P123”, the formula returns the price from column B on the row where column A has “P123”.

XLOOKUP also has optional arguments: [if_not_found], [match_mode], [search_mode]. The most useful is if_not_found – add text like "Not found" as the fourth argument: =XLOOKUP(D2, A2:A10, B2:B10, "Not found"). That way, if the ID doesn’t exist, you see a friendly message instead of #N/A.

How to Use XLOOKUP: Step-by-Step Example

  1. Open a new Excel sheet. Put product names in A1:A5 (e.g., “Apple”, “Banana”, “Cherry”) and prices in B1:B5 (e.g., 0.5, 0.3, 1.2).
  2. In D1, type a product name, like “Cherry”.
  3. In E1, type: =XLOOKUP(D1, A1:A5, B1:B5) and press Enter.
  4. E1 shows 1.2, the price for Cherry.

If you type “Grape” in D1 (not in the list), the formula returns #N/A. To avoid that, change the formula to =XLOOKUP(D1, A1:A5, B1:B5, "Not available") – now it shows “Not available”.

On Mac, the function works the same; just type the formula in the formula bar or use the Function Library under Formulas > Lookup & Reference.

How to Choose: XLOOKUP vs. VLOOKUP vs. INDEX/MATCH

Pick XLOOKUP unless you’re using an older Excel version. If you share files with colleagues on Excel 2019 or earlier, they’ll see #NAME? errors. In that case, use VLOOKUP or INDEX/MATCH. VLOOKUP is simpler but limited to left-to-right lookups. INDEX/MATCH is more flexible but harder to write. XLOOKUP combines the best of both: simple syntax, left/right/up/down searching, and built-in error handling.

For a two-way lookup (finding a value at the intersection of a row and column), XLOOKUP can work with nested calls, but it’s often easier to use INDEX and MATCH. Example: with months in A1:E1 and products in A2:A5, to find sales for “March” and “Product B”, use =INDEX(B2:E5, MATCH("Product B", A2:A5, 0), MATCH("March", B1:E1, 0)). XLOOKUP can do it too: =XLOOKUP("Product B", A2:A5, XLOOKUP("March", B1:E1, B2:E5)), but the INDEX/MATCH version is clearer for many users.

Common Problems and How to Fix Them

  • #NAME? error – Your Excel version doesn’t support XLOOKUP (needs 2021 or Microsoft 365). Use VLOOKUP instead.
  • #N/A error – The lookup value isn’t found. Add a fourth argument for a custom message, or check for extra spaces in your data.
  • #VALUE! error – The lookup_array and return_array are different sizes. Make sure they have the same number of rows (or columns for horizontal lookup).
  • Wrong results – If your data has duplicates, XLOOKUP returns the first match by default. To get the last match, use the search_mode argument: =XLOOKUP(D2, A2:A10, B2:B10, , , -1) (the -1 means search from last to first).

Also, XLOOKUP is case-insensitive by default. If you need case-sensitive matching, set match_mode to 1: =XLOOKUP(D2, A2:A10, B2:B10, , 1). That treats “apple” and “APPLE” as different.

Comparisons: XLOOKUP vs. FILTER and INDEX/MATCH

XLOOKUP returns one value. If you need multiple matching rows, use FILTER. For example, to get all prices for products starting with “A”, use =FILTER(B2:B10, LEFT(A2:A10,1)="A") – that returns an array of prices. XLOOKUP can’t do that. INDEX/MATCH is still useful for two-way lookups and for older versions. In general, use XLOOKUP for simple lookups, FILTER for multiple results, and INDEX/MATCH for complex intersections or when you need to avoid XLOOKUP’s default behavior.

Costs and Version Requirements

XLOOKUP itself costs nothing – it’s a built-in function. The catch is the software version. XLOOKUP is available in:

  • Microsoft 365 (subscription, about $6–$10 per month for personal use)
  • Excel 2021 (one-time purchase, about $140–$160)
  • Excel for the web (free with a Microsoft account)

It is NOT in Excel 2019, 2016, or earlier. If you’re using a free alternative like Google Sheets, XLOOKUP also works there (as of 2022), but the syntax is identical. If you’re on an older Excel, you can still use VLOOKUP or INDEX/MATCH without paying anything extra.

Safety and Accuracy Tips

Always double-check that your lookup_array and return_array are the same size. A common mistake is selecting entire columns (A:A) for one and a limited range for the other – that causes errors. Also, be careful with numbers stored as text. If your lookup value is a number but the lookup column has text-formatted numbers, XLOOKUP won’t match them. Fix by selecting the column and using Data > Text to Columns > Finish, or use the VALUE function. For sensitive data, XLOOKUP doesn’t change your data, but if you’re using it in a shared workbook, be aware that formulas recalculate when someone edits – that’s normal. Always save a copy before making major formula changes, especially if you’re using macros (but XLOOKUP is a regular function, so no macro risk).

Frequently Asked Questions

Can XLOOKUP return multiple columns? Yes, if you give a return_array that spans multiple columns, XLOOKUP returns the whole row of values. For example, =XLOOKUP(D2, A2:A10, B2:C10) returns two cells side by side. But if you put it in a single cell, it shows the first value only. To spill multiple results, enter the formula in a range or use it in a dynamic array – in Microsoft 365, it automatically spills.

Is XLOOKUP faster than VLOOKUP? Generally yes, especially on large datasets, because XLOOKUP uses binary search by default (search_mode 2) rather than scanning every row. But the difference is only noticeable with tens of thousands of rows. For most spreadsheets, speed is not a concern.

How do I do a horizontal lookup with XLOOKUP? Same function – just use rows instead of columns. If your lookup values are in row 1 and results in row 2, use =XLOOKUP(D1, A1:E1, A2:E2). XLOOKUP works both vertically and horizontally without a separate HLOOKUP.

What if I need to look up based on two criteria? Use the ampersand to combine criteria. For example, with first names in A, last names in B, and scores in C, to find the score for “John Smith”, use =XLOOKUP("John"&"Smith", A2:A10&B2:B10, C2:C10). This creates an array of combined names, and XLOOKUP matches the combined lookup value.

Does XLOOKUP work in Google Sheets? Yes, Google Sheets added XLOOKUP in 2022. It works the same way, but the if_not_found argument is required in Google Sheets – you must provide a fourth argument or it returns #N/A. In Excel, it’s optional.

Can XLOOKUP replace INDEX/MATCH entirely? For most lookups, yes. But INDEX/MATCH is still better for two-way lookups where you want a single formula that’s easier to read, and it works in every Excel version. XLOOKUP is the modern default, but knowing INDEX/MATCH is useful for legacy files.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.