Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel XLOOKUP Return All Matches: Step-by-Step Guide

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To return all matches in Excel, you cannot use the XLOOKUP function alone because it is designed to return only the first or last match it finds. Instead, you must use the FILTER function. While XLOOKUP is excellent for single-result lookups, the FILTER function allows you to extract every row that meets your specific criteria and spill those results into a dynamic array. This achieves the goal of a "multi-match lookup" by creating a list of all corresponding values associated with a single search term.

What You'll Need

  • A version of Excel that supports Dynamic Arrays (Microsoft 365, Excel 2021, or Excel for the Web).
  • A dataset organized in columns or a formal Excel Table (Ctrl + T).
  • A specific search value (the criteria) you want to match against your data.
  • Sufficient empty cells below and to the right of your formula to allow the results to "spill."

Step-by-Step

  1. Identify Your Data Ranges: Determine which column contains the value you are searching for (the lookup array) and which column(s) contain the information you want to retrieve (the return array). For example, if you have a list of sales, Column A might be the "Salesperson Name" and Column B might be the "Sale Amount."
  2. Select the Output Cell: Click on the cell where you want the first result to appear. Ensure there are no other pieces of data in the cells directly below or to the right of this cell, as the FILTER function requires open space to output multiple rows.
  3. Enter the FILTER Formula: Type the following formula structure: =FILTER(array, include, [if_empty]).
  4. Define the Array: In the first argument (array), highlight the range of cells that contains the data you want to return. If you want to return the Sale Amount from the previous example, select the range in Column B (e.g., B2:B100). If you want to return multiple columns (e.g., both Date and Amount), select the entire range across those columns (e.g., B2:C100).
  5. Define the Include Criteria: In the second argument (include), select the column you are searching through and set it equal to your search term. For example, if your search term is written in cell E1, the argument would be A2:A100=E1. This tells Excel to look at the names in Column A and find every instance that matches the value in E1.
  6. Handle Empty Results: In the third optional argument ([if_empty]), enter a text string in quotes to display if no matches are found, such as "No matches found". This prevents the formula from returning a #CALC! error.
  7. Execute and Spill: Press Enter. Excel will automatically "spill" all matching records into the cells below. You will notice a thin blue border surrounding the entire range of returned results; this indicates a dynamic array.
  8. Format the Results: Since the FILTER function only returns raw data, you may need to apply currency, date, or percentage formatting to the spill range to make the data readable.

Common Mistakes

One of the most frequent errors is the #SPILL! error. This happens when the FILTER function finds multiple matches, but there is existing data in the cells where the results are supposed to go. Excel will not overwrite your existing data; instead, it will show a #SPILL! error. To fix this, clear all cells below and to the right of the formula cell.

Another common mistake is mismatched range sizes. For the FILTER function to work, the "array" and the "include" range must have the same number of rows. If your return array is B2:B100 but your criteria range is A2:A50, Excel will return a #VALUE! error because the dimensions do not align.

Users also frequently forget that the FILTER function is case-insensitive by default. If you need to distinguish between "Apple" and "apple," a standard FILTER formula will not work. You would need to incorporate the EXACT function within the filter criteria, which adds complexity to the formula.

Finally, some users try to use XLOOKUP inside a FILTER function. While possible for advanced nesting, it is usually unnecessary. XLOOKUP is built to stop at the first match; attempting to force it to return all matches is a fundamental misunderstanding of how the function's logic is programmed.

Tips

Use Excel Tables: Instead of using fixed ranges like A2:A100, convert your data into a Table (Insert > Table). This allows you to use structured references like . The benefit is that as you add new rows to your table, the FILTER formula updates automatically without you needing to change the range references.

Combine with SORT: To make your returned list more useful, wrap the FILTER function inside a SORT function. For example: =SORT(FILTER(B2:C100, A2:A100=E1), 2, 1). This will return all matches and then sort them by the second column in ascending order.

Return Only Unique Values: If your data has duplicates and you only want a list of unique matching entries, wrap the formula in the UNIQUE function: =UNIQUE(FILTER(B2:B100, A2:A100=E1)). This is particularly helpful when generating lists of unique customers who have made multiple purchases.

Dynamic Search Boxes: Instead of typing a name directly into the formula, link the "include" argument to a cell. This turns that cell into a search box. Every time you change the name in that cell, the entire list of matches will instantly update.

Troubleshooting

If your formula returns a #CALC! error, it usually means that no matches were found for your criteria. The simplest fix is to ensure you have provided the [if_empty] argument in your formula. If you have already provided it and still see the error, double-check for leading or trailing spaces in your search term or your source data. A cell containing "John " (with a space) will not match a search for "John".

If you see a #VALUE! error, check your range heights. Ensure that both the return array and the criteria array start and end on the same row numbers. If one is A2:A100 and the other is B1:B100, the offset will cause the formula to fail.

If the results appear but are incorrectly formatted (e.g., dates appearing as numbers like 45231), select the spill range and change the Number Format in the Home tab of the ribbon to "Short Date". The FILTER function retrieves the value but does not retrieve the cell's formatting.

If the formula is not updating when you change the source data, check your Calculation Options. Go to the Formulas tab > Calculation Options and ensure that "Automatic" is selected. If it is set to "Manual," you will need to press F9 to refresh the results.

Frequently Asked Questions

Can I use this in Excel 2016 or 2019?

No, the FILTER function and dynamic arrays are only available in Microsoft 365, Excel 2021, and Excel for the Web. Users of older versions must use complex Array Formulas involving INDEX, SMALL, and IF, or use a Pivot Table to achieve similar results.

How do I filter for multiple different criteria at once?

To filter for multiple matches (e.g., Salespeople named "John" OR "Jane"), use the addition symbol in the include argument: =FILTER(B2:B100, (A2:A100="John") + (A2:A100="Jane")). The plus sign acts as an "OR" operator in boolean logic.

How do I filter for two conditions that must both be true?

To find matches that meet two criteria (e.g., Salesperson is "John" AND Amount is greater than 100), use the multiplication symbol: =FILTER(B2:B100, (A2:A100="John") * (B2:B100>100)). The asterisk acts as an "AND" operator.

Will this slow down my workbook if I have thousands of rows?

Dynamic arrays are generally efficient, but having hundreds of complex FILTER functions across a massive workbook can impact performance. If you experience lag, consider using a Pivot Table, which is optimized for aggregating and filtering large datasets.

Can I return only a specific column if the match is in another column?

Yes. The first argument of the FILTER function (the array) should be the column you want to return, while the second argument (the include) should be the column you are searching. They do not have to be the same column.

How do I stop the results from spilling into other cells?

You cannot stop a dynamic array from spilling if it finds multiple matches. The only way to limit the output is to refine your criteria to be more specific or to use the INDEX function to wrap the FILTER function and pick only one specific row from the results.