๐ Excel Basics #21 โ XLOOKUP() Function
The "XLOOKUP()" function is the modern replacement for both "VLOOKUP()" and "HLOOKUP()". It is more flexible, easier to use, and solves many of the limitations of older lookup functions.
ยซNote: "XLOOKUP()" is available in Microsoft 365 and Excel 2021+. It is not available in Excel 2019 or earlier.ยป
๐ What is the XLOOKUP() Function?
"XLOOKUP()" searches for a value in one range and returns the corresponding value from another range.
Syntax:
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Unlike "VLOOKUP()", you don't need to specify a column number.
๐ Example 1 โ Find Employee Department
ID | Name | Department
101 | Rahul | IT
102 | Priya | HR
103 | Amit | Finance
104 | Neha | Marketing
Formula:
=XLOOKUP(103,A2:A5,C2:C5)
Result: Finance
๐ Example 2 โ Using a Cell Reference
If cell E2 contains an Employee ID:
=XLOOKUP(E2,A2:A5,C2:C5,"Employee Not Found")
If the ID exists, Excel returns the department.
If it doesn't exist, Excel displays: Employee Not Found
๐ Why XLOOKUP() is Better than VLOOKUP()
โ
Looks up values from left to right and right to left
โ
No need to count column numbers
โ
Built-in if_not_found argument
โ
Works with both vertical and horizontal data
โ
More reliable when columns are inserted or deleted
๐ VLOOKUP vs XLOOKUP()
VLOOKUP()
โข Searches only left to right
โข Uses column index numbers
โข Requires IFERROR() to handle missing values
XLOOKUP()
โข Searches in any direction
โข Uses lookup and return ranges
โข Has built-in error handling
โข Easier to read and maintain
๐ Real-World Uses
โข Find employee information
โข Retrieve product prices
โข Match customer records
โข Search invoice details
โข Build interactive dashboards
๐ Common Mistakes
โข Using lookup and return arrays of different sizes
โข Trying to use "XLOOKUP()" in older Excel versions
โข Referencing the wrong lookup range
โ
Best Practices
โข Use "XLOOKUP()" instead of "VLOOKUP()" whenever available
โข Use the "if_not_found" argument to display meaningful messages
โข Keep the lookup and return arrays the same size
โข Use structured table references for dynamic formulas
๐ก Bonus Example โ Return Multiple Columns
=XLOOKUP(E2,A2:A5,B2:C5)
If supported by your Excel version, this returns both the Name and Department for the matching Employee ID.
"XLOOKUP()" is one of the most valuable Excel functions for modern data analysis and is becoming the preferred lookup function across industries.
Double Tap โค๏ธ For More
Post #2242
3K
- โค 15