Explanation
XLOOKUP is a modern lookup function that is more flexible than traditional VLOOKUP and HLOOKUP.
It can search vertically or horizontally and can return a custom result when a value is not found.
Syntax
=XLOOKUP(lookup_value,lookup_array,return_array,[if_not_found],[match_mode],[search_mode])
Example
|
Employee ID |
Employee |
Department |
Salary |
|
E101 |
Amit |
Sales |
35000 |
|
E102 |
Neha |
HR |
42000 |
|
E103 |
Rahul |
IT |
55000 |
|
E104 |
Priya |
Finance |
48000 |
If F2 contains:
E103
Employee:
=XLOOKUP(F2,A2:A5,B2:B5,”Not Found”)
Result:
Rahul
Department:
=XLOOKUP(F2,A2:A5,C2:C5,”Not Found”)
Result:
IT
Salary:
=XLOOKUP(F2,A2:A5,D2:D5,”Not Found”)
Result:
55000
Why XLOOKUP Is Useful
- Can look left or right
- No column-number counting
- Exact match is the default
- Can display a custom “Not Found” message
- Can return values from another range
Practice
Create an Employee Lookup System using XLOOKUP.