Advanced Excel
About Lesson

Function: XLOOKUP()


The XLOOKUP function is available in Microsoft 365, Excel 2021, and Excel 2024. It is not supported in older versions like Excel 2019 and earlier.

 

🧭 Purpose:

The XLOOKUP() function is an advanced replacement for both VLOOKUP() and HLOOKUP().
It searches for a value in a column or row and returns a matching value from another column or rowin any direction (left, right, up, or down).

It also handles errors gracefully and doesn’t need column numbers like VLOOKUP.


🧮 Syntax:

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

Parameters:

Parameter Description
lookup_value The value to search for.
lookup_array The range or array to search.
return_array The range or array to return from.
[if_not_found] Optional. Message or value to return if not found.
[match_mode] Optional. Type of match:
0 = Exact match (default)
-1 = Exact or next smaller
1 = Exact or next larger
2 = Wildcard match (*, ?)
[search_mode] Optional. Search direction:
1 = Top to bottom (default)
-1 = Bottom to top

📘 Explanation:

Unlike VLOOKUP, which only looks rightward,
XLOOKUP can look left, right, up, or down — and it doesn’t break if you insert new columns.

Example:

 
=XLOOKUP("S103", A2:A10, C2:C10, "Not Found")

✅ Finds “S103” in column A and returns the corresponding value from column C.


🧑‍🎓 Example 1: Student Course Lookup

Student ID Name Course Fees (₹)
S101 Riya Sen Photoshop 15000
S102 Kunal Das Web Design 18000
S103 Arnav Roy Tally GST 12000
S104 Sneha Ghosh Excel Advanced 10000

Formula:

 
=XLOOKUP("S103", A2:A5, C2:C5, "Not Found")

✅ Result → Tally GST

🎯 Simple, readable, and dynamic — no column number needed!


📦 Example 2: Reverse Lookup (Left Lookup)

Product Name Code Price (₹)
Mobile P100 12000
Laptop P101 45000
Headphones P102 2000
Charger P103 600

You want to find Product Name based on Code — i.e., lookup to the left!

Formula:

 
=XLOOKUP("P101", B2:B5, A2:A5, "Not Found")

✅ Result → Laptop

💡 VLOOKUP can’t do this easily, but XLOOKUP can.


⚙️ Why XLOOKUP is Better:

Feature VLOOKUP XLOOKUP
Can look left
Doesn’t break when columns change
Custom error message
Works with both vertical and horizontal data
Easier to read syntax

🧩 Project Tasks for Students


🧠 Project 1 (Basic): Student Info Fetcher

Student ID Name Course Total Fees (₹)
S201 Rahul Sen Web Design 20000
S202 Nidhi Roy Tally Prime 15000
S203 Arjun Das Photoshop 18000
S204 Priya Gupta Excel Advance 12000

🎯 Task:
Enter Student ID in cell G2, and display:

  • Name

  • Course

  • Fees

Formula example:

 
=XLOOKUP(G2, A2:A5, B2:B5, "Not Found")

✅ Result: Name of Student

💡 Use 3 formulas to fetch all 3 fields (Name, Course, Fees).


🏪 Project 2 (Intermediate): Store Product Lookup

Product Code Product Name Brand Price (₹) Stock
P101 Laptop Dell 55000 15
P102 Mouse Logitech 800 50
P103 Keyboard HP 1200 30
P104 Monitor Samsung 14000 20

🎯 Task:
Create a Product Finder Tool:

  • User inputs Product Code

  • Displays Product Name, Brand, Price, and Stock

Formula:

 
=XLOOKUP(G2, A2:A5, D2:D5, "Code Not Found")

✅ You can use multiple XLOOKUPs side by side to create a complete info card.


💼 Project 3 (Hard): Employee Performance Dashboard

Emp ID Name Department Rating 2023 Rating 2024 Rating 2025
E101 Raj Malhotra HR 3.8 4.1 4.4
E102 Nidhi Sharma IT 4.2 4.3 4.6
E103 Vikram Jain Marketing 3.5 3.9 4.2
E104 Sneha Roy Accounts 4.0 4.2 4.5

🎯 Task:

  1. User inputs Employee ID (e.g., “E103”) and Year (e.g., “2024”).

  2. Excel shows the Rating for that year dynamically.

Formula:

 
=XLOOKUP(G2, A2:A5, XLOOKUP(G3, A1:F1, B2:F5))

✅ Nested XLOOKUP — works like a 2D lookup (both ID and Year).

💡 Great for dashboards where year selection changes automatically.


🧮 Project 4 (Hard): Banking Interest & EMI Calculator

Loan Type Code Interest 2024 (%) Interest 2025 (%) Max Tenure (Years)
Home Loan L101 8.3 8.5 20
Car Loan L102 9.5 9.6 7
Personal Loan L103 11.0 11.2 5
Education Loan L104 7.4 7.6 10

🎯 Task:
Create a form:

  • User enters Loan Code (e.g., “L103”)

  • Enters Year (e.g., “2025”)

  • Excel returns Interest Rate

Formula:

 
=XLOOKUP(G2, B2:B5, XLOOKUP(G3, C1:D1, C2:D5))

✅ Output → 11.2

💡 Ideal for finance projects or dashboards.


🏦 Project 5 (Hard): Dynamic Admission Fee System

Course Name Duration (Months) Fees (₹) Discount (%) Final Payable (₹)
Excel 3 5000 10 4500
Photoshop 4 8000 5 7600
Web Design 6 12000 8 11040
Tally Prime 5 10000 10 9000

🎯 Task:

  1. User inputs Course Name in a dropdown.

  2. Excel returns Fees, Discount, and Final Payable using XLOOKUP.

  3. Add logic for “Not Found” courses.

Formula examples:

 
=XLOOKUP(G2, A2:A5, C2:C5, "Course Not Found")
=XLOOKUP(G2, A2:A5, E2:E5, "Course Not Found")

✅ Gives fully dynamic results for any selected course.

💡 Extend this with Data Validation and conditional formatting to build a working fee calculator system.


Key Tip:
Always use IFERROR() or if_not_found inside XLOOKUP to keep dashboards clean:

 
=XLOOKUP(G2, A2:A10, C2:C10, "Invalid Entry")