XLOOKUP is the modern replacement for both VLOOKUP and the INDEX/MATCH combo, offering a simpler syntax and built-in error handling, while INDEX/MATCH remains a powerful, flexible fallback for older Excel versions and complex lookups. This article compares the two approaches, explains how each works, and helps you decide which to use in your spreadsheets.
Background: How Lookup Functions Evolved
For decades, Excel users relied on VLOOKUP to find values in a table. VLOOKUP had a major limitation: it could only search left to right, meaning the lookup column had to be the first column in the range. To overcome this, power users turned to a combination of INDEX and MATCH. MATCH finds the position of a value in a row or column, and INDEX returns the value at a given position in a range. Together, they could look up values in any direction and even return values to the left of the lookup column.
In 2019, Microsoft introduced XLOOKUP as part of an update to Excel 365. XLOOKUP was designed to be a single-function replacement for both VLOOKUP and INDEX/MATCH, with a more intuitive syntax and additional features like default matches and error handling. As of 2024, XLOOKUP is available in Excel 365, Excel 2021, and Excel for the web, but not in older versions like Excel 2016 or 2019.
How XLOOKUP Works
XLOOKUP searches a range or array for a lookup value and returns a corresponding value from another range. Its syntax is:
XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
- lookup_value: the value to search for (required).
- lookup_array: the range to search in (required).
- return_array: the range from which to return a result (required).
- if_not_found: optional text to return if no match is found (e.g., “Not found”).
- match_mode: optional; 0 for exact match (default), -1 for exact or next smaller, 1 for exact or next larger, 2 for wildcard match.
- search_mode: optional; 1 for search from first (default), -1 for search from last, 2 or -2 for binary search.
For example, to find the price of a product in a table where column A has product names and column B has prices, you would write:
=XLOOKUP("Widget", A2:A10, B2:B10, "Not found")
This searches for “Widget” in A2:A10 and returns the corresponding price from B2:B10. If “Widget” is not found, it returns “Not found” instead of an error.
How INDEX/MATCH Works
INDEX/MATCH is actually two functions used together. The MATCH function returns the position of a lookup value in a row or column:
MATCH(lookup_value, lookup_array, [match_type])
match_type is 0 for exact match, 1 for less than, or -1 for greater than. Then, the INDEX function returns the value at a given position in a range:
INDEX(array, row_num, [column_num])
To perform a lookup, you nest MATCH inside INDEX. For example, to find the price of a product in the same table as above:
=INDEX(B2:B10, MATCH("Widget", A2:A10, 0))
MATCH finds the row number where “Widget” appears in A2:A10, and INDEX returns the value in that row from B2:B10. This is more flexible than VLOOKUP because you can look up values to the left of the lookup column, and you can use it with rows and columns interchangeably.
Key Differences and Advantages
The most obvious difference is syntax: XLOOKUP requires three arguments (lookup value, lookup array, return array) and has optional arguments for error handling and match type. INDEX/MATCH requires two functions and more careful construction, but it works in all Excel versions.
Here are some specific advantages of XLOOKUP:
- Simpler and more readable: One function instead of two nested functions.
- Built-in error handling: The if_not_found argument lets you specify a custom message instead of #N/A.
- Default exact match: XLOOKUP defaults to an exact match, while VLOOKUP defaults to approximate match (a common source of errors).
- Can return a range: XLOOKUP can return multiple values at once (e.g., an entire row or column) if you specify a return array that spans multiple cells.
- Supports wildcards: You can use * and ? in the lookup value when match_mode is set to 2.
- Search from last: The search_mode argument allows you to find the last occurrence of a value, which is useful for logs or records.
INDEX/MATCH still has advantages in certain situations:
- Compatibility: Works in Excel 2019 and earlier, and in Google Sheets (though Google Sheets has its own XLOOKUP equivalent).
- Performance with large datasets: Some users report that INDEX/MATCH is faster on very large spreadsheets, though modern Excel has optimized XLOOKUP significantly.
- Flexibility with two-dimensional lookups: INDEX/MATCH can easily perform a lookup on both rows and columns (a matrix lookup), whereas XLOOKUP requires nesting two XLOOKUPs for the same task.
When to Use XLOOKUP vs INDEX/MATCH
In practice, the choice depends on your Excel version and your specific need.
- Use XLOOKUP if you have Excel 365 or 2021, and you want a simpler formula that is easier to read and maintain. It is especially beneficial for beginners and for spreadsheets that will be shared with others who use modern Excel.
- Use INDEX/MATCH if you need to support colleagues using older Excel versions, or if you are working with a two-dimensional lookup (e.g., finding a value at the intersection of a specific row and column).
- Use XLOOKUP for reverse lookups: If you need to find a value to the left of the lookup column, XLOOKUP does it naturally without any extra steps, while INDEX/MATCH requires you to specify the return range correctly.
For example, if you have a table with Employee ID in column B and Employee Name in column A, and you want to look up the name by ID, XLOOKUP would be:
=XLOOKUP(102, B2:B100, A2:A100)
With INDEX/MATCH, you would write:
=INDEX(A2:A100, MATCH(102, B2:B100, 0))
Both work, but XLOOKUP is more intuitive.
Common Problems and How to Avoid Them
One common issue with XLOOKUP is that it returns #VALUE! if the lookup array and return array are not the same size. This is easy to avoid by ensuring both ranges have the same number of rows (or columns if you’re using horizontal lookups).
Another issue is with approximate matches. If you forget to set match_mode to 0 (exact match), XLOOKUP defaults to exact match, so that’s actually safer than VLOOKUP. However, if you need an approximate match (e.g., for tax brackets), you must specify match_mode as -1 or 1, and ensure your lookup array is sorted correctly.
For INDEX/MATCH, a common mistake is using the wrong match_type. If you use 1 or -1 without sorting, you’ll get incorrect results. Always use 0 for exact match unless you specifically need an approximate match.
Another pitfall is referencing entire columns (e.g., A:A) in XLOOKUP, which can slow down calculation if your spreadsheet has many formulas. It’s better to limit the range to the actual data area.
Frequently Asked Questions
Is XLOOKUP faster than INDEX/MATCH?
In most cases, XLOOKUP is comparable in speed to INDEX/MATCH, and Microsoft has optimized it for large datasets. However, some users report that INDEX/MATCH can be faster on very large spreadsheets (hundreds of thousands of rows) because it avoids the overhead of error handling. The difference is usually negligible for typical use.
Can I use XLOOKUP in Excel 2016?
No, XLOOKUP is only available in Excel 365, Excel 2021, and Excel for the web. If you are using Excel 2016 or 2019, you can use INDEX/MATCH or VLOOKUP instead.
How do I do a two-way lookup (both row and column) with XLOOKUP?
You can nest two XLOOKUPs: one to find the row, and one to find the column. For example, to find the value at the intersection of a specific row label and column label, you would use: XLOOKUP(row_label, row_headers, XLOOKUP(col_label, col_headers, data_range)).
Does XLOOKUP work in Google Sheets?
Google Sheets has its own XLOOKUP function that works similarly, but it was added later and has some differences in syntax (e.g., the match mode and search mode arguments are slightly different). If you’re using Google Sheets, you can use XLOOKUP, but be aware of these differences.
What is the difference between XLOOKUP and VLOOKUP?
XLOOKUP is a modern replacement for VLOOKUP. Unlike VLOOKUP, XLOOKUP can look up values to the left, supports error handling, defaults to exact match, and can return multiple values. VLOOKUP is still available for backward compatibility but is generally harder to use correctly.
Can I use XLOOKUP to return multiple columns?
Yes, if you specify a return array that spans multiple columns, XLOOKUP will return an array of values. For example, XLOOKUP("Widget", A2:A10, B2:C10) returns the values from columns B and C for the matching row. This is useful for pulling multiple related fields at once.
Final Thoughts
For most users, XLOOKUP is the better choice because it is simpler and more intuitive. If you are starting a new spreadsheet and have access to Excel 365, use XLOOKUP. If you need to share your workbook with people using older Excel versions, or if you are doing complex two-dimensional lookups, INDEX/MATCH is still a reliable tool. Both are valuable to know, and understanding both will make you a more flexible Excel user.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Philips DST7060/20 7000 Series Iron: Specs & Fit
- Coal Fueled Jet Aircraft: Could It Work?675 L
- Remote Desktop on Raspberry Pi: How to Enable It
- Word Select Last Line in Paragraph?
- Google Assistant IFTTT Recipes: 7 Useful Automations
- OLED TVs in Dark Rooms: Why They Look Better and When They Don’t