How to Use XLOOKUP in Excel as a Powerful Replacement for VLOOKUP

The Death of VLOOKUP

For decades, VLOOKUP was the most famous—and most frustrating—function in Microsoft Excel. It was the standard way to merge data from two different tables. However, VLOOKUP had severe, fundamental flaws:

  1. It only looks right: VLOOKUP can only search for a value in the very first column of a table, and return a result from a column to the right of it. If your reference data is to the left, the function breaks.
  2. It breaks when columns are inserted: Because VLOOKUP relies on a hard-coded column index number (e.g., “return the data from the 4th column”), if a colleague inserts a new column into the middle of the table, your formula will suddenly pull the wrong data without warning.
  3. It defaults to approximate matches: If you forget to type the word FALSE at the very end of the formula, Excel will guess the closest match, resulting in catastrophically inaccurate financial reporting.

Microsoft finally solved all of these problems by releasing XLOOKUP, a modern, incredibly powerful replacement function available in Microsoft 365 and Excel 2021.

The Syntax of XLOOKUP

The beauty of XLOOKUP is its simplicity. It requires only three core arguments:

=XLOOKUP(lookup_value, lookup_array, return_array)
  • lookup_value: What are you looking for? (e.g., an Employee ID number).
  • lookup_array: Where is the list of ID numbers? (The single column to search).
  • return_array: What data do you want back? (The single column containing the names, salaries, etc.).

Step-by-Step Example: Looking Left

Assume you have a reference table where Column A contains Employee Names, and Column B contains Employee ID numbers.

On your active sheet, you type an ID number in cell D2. You want a formula in cell E2 to fetch the corresponding Employee Name.

Because the Names (Column A) are to the left of the ID numbers (Column B), VLOOKUP is completely incapable of solving this without complex INDEX/MATCH workarounds.

With XLOOKUP, it is trivial:

  1. Click in cell E2.
  2. Type the formula:
    =XLOOKUP(D2, B:B, A:A)

Explanation: Take the ID number typed in D2. Search for it in Column B. When you find it, give me the corresponding name from Column A. It works flawlessly in any direction. Furthermore, because you selected specific columns rather than a grid, if someone inserts a new column between A and B, the formula automatically adjusts and will not break.

Advanced Feature: Built-in Error Handling

When VLOOKUP fails to find a match, it displays the ugly #N/A error. To fix this, users had to wrap the entire formula in a complicated IFERROR function.

XLOOKUP has error handling built directly into its fourth, optional argument.

=XLOOKUP(D2, B:B, A:A, "Employee Not Found")

Now, if someone types an ID number that does not exist in the database, the cell will cleanly display the text “Employee Not Found” instead of crashing with an error code.

Advanced Feature: Searching Bottom-to-Top

If your dataset contains duplicate entries (e.g., a log of price changes for a specific product), VLOOKUP will always return the first instance it finds, starting from the top.

If you want to find the most recent price change at the bottom of the list, XLOOKUP allows you to reverse the search direction using its sixth argument (search mode).

=XLOOKUP(D2, B:B, A:A, "Not Found", 0, -1)

The -1 at the end instructs Excel to start searching from the absolute bottom of the spreadsheet and work its way up, ensuring you retrieve the latest chronological data.

Conclusion

If you are using a modern version of Excel, there is zero reason to ever use VLOOKUP or HLOOKUP again. XLOOKUP is faster, vastly more resilient to spreadsheet alterations, and handles complex formatting logic with elegant simplicity.

RELATED POSTS

  • How to Use Excel Goal Seek for Reverse Mathematical Modeling
  • How to Use the SUMIF Function in Excel
  • How to Sort Data Alphabetically in Excel
  • How to Use the FREQUENCY Function to Calculate Number Distribution in Excel
  • How to Create a Pivot Table in Excel
  • Get the best tech tips delivered straight to your inbox.

    Join thousands of readers mastering Apple, Google, Microsoft, and Linux.