Thursday, 30 January 2025

xlookup

 The XLOOKUP function in Excel is a powerful tool for searching and retrieving data from a table or range. Below are 10 examples of how you can use XLOOKUP, including sample data and formulas.

Example 1: Basic XLOOKUP

Data:

Copy
A       B
1  Apple   5
2  Banana  3
3  Orange  7

Formula:

excel
Copy
=XLOOKUP("Banana", A1:A3, B1:B3)

Result:

Copy
3

Example 2: XLOOKUP with Exact Match

Data:

Copy
A       B
1  Apple   5
2  Banana  3
3  Orange  7

Formula:

excel
Copy
=XLOOKUP("Orange", A1:A3, B1:B3, 0, 0)

Result:

Copy
7

Example 3: XLOOKUP with Approximate Match

Data:

Copy
A       B
1  10     $10
2  20     $20
3  30     $30

Formula:

excel
Copy
=XLOOKUP(25, A1:A3, B1:B3, "Not Found", 1)

Result:

Copy
$20

Example 4: XLOOKUP with Wildcard

Data:

Copy
A         B
1  Apple    5
2  Banana   3
3  Orange   7

Formula:

excel
Copy
=XLOOKUP("App*", A1:A3, B1:B3)

Result:

Copy
5

Example 5: XLOOKUP with Multiple Criteria

Data:

Copy
A       B       C
1  Apple   Red    5
2  Banana  Yellow 3
3  Orange  Orange 7

Formula:

excel
Copy
=XLOOKUP(1, (A1:A3="Apple")*(B1:B3="Red"), C1:C3)

Result:

Copy
5

Example 6: XLOOKUP with Return Array

Data:

Copy
A       B       C
1  Apple   Red    5
2  Banana  Yellow 3
3  Orange  Orange 7

Formula:

excel
Copy
=XLOOKUP("Banana", A1:A3, B1:C3)

Result:

Copy
Yellow  3

Example 7: XLOOKUP with Reverse Search

Data:

Copy
A       B
1  Apple   5
2  Banana  3
3  Orange  7

Formula:

excel
Copy
=XLOOKUP("Banana", A1:A3, B1:B3, "Not Found", 0, -1)

Result:

Copy
3

Example 8: XLOOKUP with Error Handling

Data:

Copy
A       B
1  Apple   5
2  Banana  3
3  Orange  7

Formula:

excel
Copy
=XLOOKUP("Grape", A1:A3, B1:B3, "Not Found")

Result:

Copy
Not Found

Example 9: XLOOKUP with Dynamic Arrays

Data:

Copy
A       B
1  Apple   5
2  Banana  3
3  Orange  7

Formula:

excel
Copy
=XLOOKUP({"Apple", "Orange"}, A1:A3, B1:B3)

Result:

Copy
5  7

Example 10: XLOOKUP with Spill Range

Data:

Copy
A       B
1  Apple   5
2  Banana  3
3  Orange  7

Formula:

excel
Copy
=XLOOKUP(A1:A3, A1:A3, B1:B3)

Result:

Copy
5
3
7

These examples demonstrate the versatility of the XLOOKUP function in Excel, showing how it can be used for various lookup scenarios, including exact and approximate matches, wildcards, multiple criteria, and error handling.

No comments:

Post a Comment