Free · 3 minutes · no registration Your IT profession: Backend developer? Find the profession that suits me
25 November 2026

XLOOKUP or VLOOKUP? Comparing Excel's lookup functions

XLOOKUP or VLOOKUP? Comparing Excel's lookup functions

You're putting together a report: one table holds sales transactions, another holds product prices, and you need each row to pull in the matching price automatically. Excel offers several ways to do this, and most people start by learning VLOOKUP. Today, though, there are more flexible alternatives. So XLOOKUP or VLOOKUP — which one should you choose, and where does the INDEX/MATCH combination fit into the picture? In this article, we'll compare the three approaches with simple examples, look at the strengths and weaknesses of each, and explain when it makes sense to use which.

Why do you need lookup functions?

Lookup functions find a specific value in a table and return related information. In everyday office work, this is one of the most common tasks:

  • finding an employee's name and department by their personnel number;
  • pulling in a price or stock level by product code;
  • comparing two lists exported from a bank or accounting software to spot discrepancies;
  • adding a customer's region, account manager or contract date to a report based on their ID.

Doing this by hand takes time and increases the risk of mistakes. The right function, on the other hand, fills hundreds or thousands of rows in seconds.

Sample table

To keep the comparison concrete, let's take a simple table. On a sheet named Products, the data is laid out as follows:

  • column A — category;
  • column B — product code;
  • column C — product name;
  • column D — price.

The data runs from row 2 to row 500. On another sheet, cell G2 contains the product code we're looking for. The goal: find the price and category for that code.

Note: The argument separator in formulas depends on Excel's regional settings. Some computers use a comma (,), others a semicolon (;). The examples use commas; if you get an error, replace them with semicolons.

VLOOKUP: classic, but limited

VLOOKUP is one of Excel's best-known functions and works in almost every version. Its syntax is:

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

The formula to find the price:

=VLOOKUP(G2, Products!B2:D500, 3, FALSE)

In the range B2:D500, column B is the first column and column D is the third, so we enter 3. The last argument, FALSE, means an exact match.

VLOOKUP's weaknesses

  1. It only looks to the right. The lookup value has to be in the first column of the table. The category is in column A, to the left of the code, so VLOOKUP can't return it directly.
  2. The column number is hard-coded. If a new column is inserted in the middle of the table, the 3 doesn't update automatically, and the formula starts pulling data from the wrong column. This is one of the hardest errors to track down in reports.
  3. The default mode is risky. If the fourth argument is omitted, Excel uses an approximate match (TRUE). In an unsorted table, this can return a wrong result without any error message.
  4. #N/A when nothing is found. To display the result cleanly, you have to wrap the formula in IFERROR or IFNA.

Even so, knowing VLOOKUP is still important: a large share of older files and templates are built on this very function, and you'll need to read and fix them.

INDEX/MATCH: a flexible, all-purpose combination

To get around VLOOKUP's limitations, experienced users have combined two functions for many years. MATCH finds the position of the lookup value in a range, and INDEX returns the value at that position from another column:

=INDEX(Products!D2:D500, MATCH(G2, Products!B2:B500, 0))

The 0 in MATCH means an exact match. To find the category (the column on the left), we simply change the INDEX range:

=INDEX(Products!A2:A500, MATCH(G2, Products!B2:B500, 0))

Advantages

  • you can look up in any direction — both right and left;
  • there's no column number, since ranges are referenced directly, so the formula doesn't break when a new column is added;
  • with two MATCH functions, you can build a lookup by both row and column (a two-way lookup);
  • it works in older versions of Excel too.

Disadvantages

The main drawback is readability: for beginners, two nested functions look confusing at first. On top of that, you still need to add IFNA or IFERROR to handle values that aren't found.

XLOOKUP: a modern, simple solution

XLOOKUP is available in Microsoft 365, Excel 2021 and later, as well as in Excel for the web. It combines the simplicity of VLOOKUP with the flexibility of INDEX/MATCH in a single function:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

Finding the price:

=XLOOKUP(G2, Products!B2:B500, Products!D2:D500, "Not found")

To find the category, we just set the return range to column A — looking to the left requires no extra tricks.

XLOOKUP's key advantages

  • Exact match by default. There's less chance of a silent error caused by a forgotten argument.
  • A built-in "not found" message. The text in the fourth argument is shown instead of #N/A, so there's no need for IFNA.
  • Lookup in any direction. The lookup and return ranges are specified separately.
  • Searching from last to first. By setting the search_mode argument to -1, you can find the last matching entry in a list. This is very handy, for example, for retrieving a customer's most recent order.
  • Returning several columns at once. If you set the return range to Products!C2:D500, the result "spills" both the name and the price into adjacent cells (a dynamic array).
  • Wildcards. By setting the match_mode argument to 2, you can run partial-match searches using the * and ? characters.

A few examples:

=XLOOKUP(G2, Products!B2:B500, Products!C2:D500, "Not found")
=XLOOKUP(H2, Orders!B2:B5000, Orders!E2:E5000, "-", 0, -1)

The first formula returns the product name and price together, while the second finds the amount of the last order in the list for the customer in H2.

XLOOKUP's limitation

The main limitation is compatibility: XLOOKUP isn't available in Excel 2019, 2016 or older versions. If colleagues or clients using those versions open your file, they'll see errors where the formulas should be. So before sharing a file, it's a good idea to check which version of Excel the recipients use.

A practical scenario: looking up a value by range

A lookup doesn't always mean an exact match. Let's say sales managers' bonus percentage depends on their sales volume: one rate applies above a certain threshold, and a higher rate above the next one. On the Bonuses sheet, column A contains the thresholds (0, 5000, 10000, 20000) and column B the corresponding percentages. The manager's sales amount is in cell E2.

With VLOOKUP, this is solved in approximate match mode, but the thresholds must be sorted in ascending order:

=VLOOKUP(E2, Bonuses!A2:B5, 2, TRUE)

In XLOOKUP, we set the match_mode argument to -1, which means "exact match or, if there isn't one, the next smaller value":

=XLOOKUP(E2, Bonuses!A2:A5, Bonuses!B2:B5, 0, -1)

In this mode, XLOOKUP doesn't require the table to be sorted, but keeping the thresholds in logical order is still a good habit for readability.

Two-way lookup

Sometimes you need to find a value by both its row and column headers: for example, a specific product's figure for a specific month in a monthly sales table. With INDEX/MATCH, this is done with two MATCH functions; with XLOOKUP, one XLOOKUP is nested inside another:

=INDEX(B2:M50, MATCH(P2, A2:A50, 0), MATCH(Q2, B1:M1, 0))
=XLOOKUP(P2, A2:A50, XLOOKUP(Q2, B1:M1, B2:M50))

Both formulas return the value for the product in P2 for the month in Q2. Here, the inner XLOOKUP returns the entire column for the required month, and the outer one finds the row for the product in that column.

Comparison at a glance

  • Version support: VLOOKUP and INDEX/MATCH — almost all versions; XLOOKUP — Microsoft 365, Excel 2021 and later, Excel for the web.
  • Looking to the left: VLOOKUP — no; INDEX/MATCH — yes; XLOOKUP — yes.
  • Resilience to inserted columns: VLOOKUP — low; INDEX/MATCH and XLOOKUP — high.
  • Default match mode: VLOOKUP — approximate; MATCH — approximate (you need to enter 0); XLOOKUP — exact.
  • Value not found: VLOOKUP and INDEX/MATCH — require IFNA/IFERROR; XLOOKUP — built-in argument.
  • Readability: VLOOKUP — simple; INDEX/MATCH — moderate; XLOOKUP — simple.

Which one should you choose, and when?

In practice, the choice mostly depends on your work environment:

  1. If your company uses Microsoft 365 — make XLOOKUP your go-to function for new reports. Formulas are shorter and easier to read, and some typical errors simply go away.
  2. If the file will also be opened in older versions — INDEX/MATCH is the most reliable choice: it's flexible and works everywhere.
  3. If you're updating an existing file — don't rush to replace formulas built with VLOOKUP. First understand how they work, then update them gradually where needed.

Either way, as a professional, it pays to know all three: when you join a new company, you never know in advance what files you'll come across.

Common mistakes

  • Extra spaces. To Excel, "A101" and "A101 " are different values. Use the TRIM function to clean up spaces in imported data.
  • Numbers stored as text. If a code is formatted as a number in one table and as text in another, the lookup won't return a result. Make the formats consistent.
  • Forgetting absolute references. When you drag a formula down, the range shifts too. Lock the range as $B$2:$B$500, or convert the data into an Excel table (Ctrl+T) and use structured references.
  • Duplicate keys. If the same code appears several times in the lookup column, the functions return only the first match (or, optionally, the last one in XLOOKUP). If you need all matching rows, take a look at the FILTER function.
  • Hiding all errors. IFERROR hides every type of error, including genuine mistakes in the formula. If you only want to handle the "not found" case, IFNA is the more precise choice.

Conclusion

VLOOKUP, INDEX/MATCH and XLOOKUP solve the same problem, but offer different levels of flexibility and reliability. If you work in a modern version of Excel, XLOOKUP makes everyday reporting easier; if compatibility matters, INDEX/MATCH is a reliable alternative; and VLOOKUP is worth knowing, at the very least, to understand older files. The best way to learn is to try all three on your own real spreadsheets.

If you'd like to learn lookup functions, pivot tables, data cleaning and building dynamic dashboards systematically, through hands-on assignments, take a look at the Advanced Excel course.

Course programs

Electronics courses

System administration courses

Mobile programming courses

Office Software Courses

1Z0-829 – Java SE 17 Developer (Java 17)

Front-end programming courses

IT Business Analyst Courses

Open banking courses

Don't know where to start?

Apply

Complete your application for the chosen course and let us share our knowledge with you.

+994
+ Add a message

Your data is used only to contact you.

Contact us directly (+994 10) 234 65 56
  • Address
  • 609 Jafar Jabbarli St., Baku / Globus Center

  • Social networks