Mastering Excel's XLOOKUP to Return All Matches
In the realm of data analysis, Excel has long been a staple tool, and with the introduction of the XLOOKUP function in Office 365 and Excel 2021, finding and returning data has become more efficient than ever. One of its standout features is its ability to return all matches, a capability that was previously cumbersome with older functions like VLOOKUP and INDEX-MATCH. Let's delve into how you can leverage XLOOKUP to return all matches with ease.
Understanding XLOOKUP's Syntax
Before we dive into returning all matches, it's crucial to understand XLOOKUP's basic syntax. The function follows this structure:
XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
Here's a brief explanation of each argument:

- lookup_value: The value you're searching for within the lookup_array.
- lookup_array: The range of cells where you're searching for the lookup_value.
- return_array: The range of cells from which you want to return the corresponding value(s).
- if_not_found: (Optional) The value to return if no match is found.
- match_mode: (Optional) Determines how Excel should match the lookup_value. Default is 0 (exact match).
- search_mode: (Optional) Determines whether to search the entire lookup_array or just the leftmost column. Default is 1 (search the entire array).
Returning All Matches with XLOOKUP
To return all matches, we'll use an array of lookup_values and a trick with the IFERROR function. Here's how:
Step 1: Prepare Your Data
Assume you have the following data:
| Fruits | Quantities |
|---|---|
| Apple | 10 |
| Banana | 15 |
| Apple | 5 |
| Orange | 8 |
Step 2: Use XLOOKUP with IFERROR
In a new column, use the following formula:

IFERROR(XLOOKUP(A2:A4, Fruits, Quantities), "Not Found")
Here's what this formula does:
- XLOOKUP searches for the values in cells A2:A4 (Apple, Banana, Apple) within the Fruits range.
- If it finds a match, it returns the corresponding quantity from the Quantities range.
- IFERROR wraps the XLOOKUP function and returns "Not Found" if no match is found.
Step 3: Drag the Formula Down
Drag the formula down to copy it for the rest of the cells. You'll see that it returns all matches for each lookup_value:
| Fruits | Quantities |
|---|---|
| Apple | 10 |
| Banana | 15 |
| Apple | 5 |
| Orange | 8 |
| 10 | |
| 5 |
Conclusion and Further Exploration
Mastering XLOOKUP's ability to return all matches opens up a world of possibilities for data analysis and manipulation in Excel. From this foundation, you can explore other aspects of XLOOKUP, such as approximate matches, wildcard searches, and more. Keep practicing and expanding your Excel skills to unlock the full potential of this powerful tool.






















