Google Sheets XLOOKUP Multiple Matches: How To

How-to basics · Updated November 23, 2026

To return multiple matches with XLOOKUP in Google Sheets, you cannot use XLOOKUP alone—it only returns the first match. Instead, combine FILTER with XLOOKUP (or use FILTER by itself) to extract all matching rows. For example, =FILTER(B2:B20, A2:A20 = "Widget") returns every value in B2:B20 where the corresponding A-column cell equals “Widget”.

Why XLOOKUP Alone Won’t Work

XLOOKUP is designed to find one value in a range and return a corresponding value from another range. When multiple rows share the same lookup key, XLOOKUP stops at the first occurrence and returns that single result. This is true in both Google Sheets and Excel. If you need all matches, you must use a function that processes an array, such as FILTER, QUERY, or a combination of INDEX and SMALL.

Using FILTER to Get All Matches

FILTER is the simplest way to return multiple matches. It takes a range to return and a condition, and outputs an array of all rows that meet the condition. For example, with a product list in A2:A20 and prices in B2:B20, to get all prices for “Widget”:

  • In cell D2, enter =FILTER(B2:B20, A2:A20 = "Widget")
  • Press Enter. The results spill down automatically into D2, D3, D4, etc.
  • If no matches exist, FILTER returns a #N/A error. To avoid this, wrap it in IFERROR: =IFERROR(FILTER(B2:B20, A2:A20 = "Widget"), "No matches")

You can also return multiple columns. To get both product name and price for all “Widget” rows, use =FILTER(A2:B20, A2:A20 = "Widget").

Combining XLOOKUP with FILTER for a Dynamic Lookup

If you want to use XLOOKUP to find a value and then return all associated matches, you can nest FILTER inside XLOOKUP’s lookup array. For instance, to find all sales amounts for a customer named “John” from a table with customers in A2:A20 and amounts in B2:B20:

  1. In cell D2, enter the customer name “John”.
  2. In E2, enter =FILTER(B2:B20, A2:A20 = D2)

This returns all amounts for John. To make it fully dynamic, you can use XLOOKUP to pull the customer name from a dropdown, but the FILTER itself does the heavy lifting. A common pattern is =FILTER(B2:B20, A2:A20 = XLOOKUP(D2, E2:E10, F2:F10)) where XLOOKUP finds a code and FILTER returns all rows matching that code.

Using QUERY for More Complex Matching

QUERY is a powerful alternative, especially when you need to filter with multiple conditions, sort results, or limit columns. The syntax is =QUERY(data, query, [headers]). For example, to get all rows where column A contains “Widget” and column C is greater than 100, with data in A1:C20:

=QUERY(A1:C20, "SELECT * WHERE A = 'Widget' AND C > 100", 1)

Note that QUERY uses SQL-like syntax, and text values must be enclosed in single quotes. The third argument (1) tells Sheets that the first row is a header. QUERY is case-sensitive by default; use LOWER() to make it case-insensitive.

Returning Multiple Matches with INDEX and SMALL

If you need to return matches in separate cells without using array formulas (for compatibility with older workflows), you can use an array formula with INDEX and SMALL. This is more complex but works in both Google Sheets and Excel. For example, to list all prices for “Widget” vertically:

  1. In D2, enter =ARRAYFORMULA(IFERROR(INDEX(B2:B20, SMALL(IF(A2:A20 = "Widget", ROW(A2:A20)-1), ROW()-1))))
  2. Drag down to fill as many rows as you expect matches.

This formula works by creating an array of row numbers where the condition is true, then SMALL picks the nth smallest, and INDEX returns the value. It’s less intuitive, so FILTER is usually preferred.

Common Problems and Solutions

  • #N/A error from FILTER: Wrap in IFERROR to show a custom message.
  • Results not spilling: Ensure the cells below are empty. If you see a #REF! error, clear the cells.
  • Case sensitivity: FILTER and QUERY are case-sensitive. Use =FILTER(B2:B20, LOWER(A2:A20) = LOWER("widget")) to ignore case.
  • Multiple conditions: Use * for AND and + for OR in FILTER: =FILTER(B2:B20, (A2:A20 = "Widget") * (C2:C20 > 100))
  • Blank cells in results: FILTER skips blanks automatically, but if you want to include them, use =FILTER(B2:B20, (A2:A20 = "Widget") + (B2:B20 = ""))

Comparison with Excel’s XLOOKUP

In Microsoft Excel, XLOOKUP also returns only the first match. However, Excel 365 offers the FILTER function as well, so the same approach works. The main difference is that Google Sheets uses =ARRAYFORMULA in some contexts, while Excel 365 handles dynamic arrays automatically. For example, in Excel, =FILTER(B2:B20, A2:A20 = "Widget") spills without needing ARRAYFORMULA. In older Excel versions without FILTER, you’d need INDEX/SMALL or the legacy CSE array formulas.

Frequently Asked Questions

Can XLOOKUP return multiple matches in Google Sheets?

No, XLOOKUP in Google Sheets is designed to return a single value. It will always return the first match found. To get all matches, you must use FILTER, QUERY, or a combination of INDEX and SMALL.

How do I get all matches without using an array formula?

If you prefer not to use array formulas, you can use QUERY, which is a single formula that outputs multiple rows. Alternatively, you can use a helper column with a formula like =IF(A2="Widget", B2, "") and then filter out blanks manually.

Why does FILTER return a #VALUE! error?

This usually happens when the ranges in the condition and the return range have different sizes. Ensure both ranges have the same number of rows. Also, check that the condition range is a single column, not a multi-column range.

Is there a way to return multiple matches in separate columns instead of rows?

Yes, you can use TRANSPOSE with FILTER: =TRANSPOSE(FILTER(B2:B20, A2:A20 = "Widget")) will put the results horizontally. For more complex layouts, use QUERY with pivot clauses.

Can I use XLOOKUP to return the second or third match?

Yes, you can use XLOOKUP with a filtered array. For example, to get the second match, use =INDEX(FILTER(B2:B20, A2:A20 = "Widget"), 2). This returns the second value from the filtered array.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.