Function Problems

Microsoft 365 Excel: Search Multiple Two-Dimensional Arrays and Return Matching Rows

Huda QurayshiHuda Qurayshi Nov 12, 2026 869 views

Question details

The user needs to search several two-dimensional arrays for a text value and return every row that contains a match.

Product
Microsoft 365 Excel
Device & OS
not provided
Scenario
Multiple named arrays must be combined and searched, either across all columns or within a specific column.
Observed behavior
The required matching rows need to be dynamically combined into one result array.
Before you start

Confirm that the source arrays have the same number of columns and that the search text is stored in a cell or named range such as SEARCHTXT. Check that your Excel version supports VSTACK, FILTER, BYROW, and LAMBDA.

Solution 1Recommended

Combine the arrays and filter every row containing the search text

Use this Microsoft 365 formula when a match in any column should return the complete row.

VSTACK creates one vertical array from the source arrays. BYROW checks each combined row, while FILTER returns only rows where SEARCH finds the requested text.

SEARCH is not case-sensitive. Use FIND instead if the search must be case-sensitive.

1
Prepare the source arrays

Define or confirm two same-width arrays, such as myArrA and myArrB, and place the search value in the named range SEARCHTXT.

2
Enter the dynamic array formula

Select the top-left output cell and enter =LET(all,VSTACK(myArrA,myArrB),FILTER(all,BYROW(all,LAMBDA(row,OR(ISNUMBER(SEARCH(SEARCHTXT,row))))))). Press Enter to spill the matching rows.

3
Add more arrays if needed

Extend the VSTACK section, for example VSTACK(myArrA,myArrB,myArrC), while keeping the FILTER and BYROW portions unchanged.

Result: The output updates automatically when the source arrays or SEARCHTXT value changes.

Search and return matching rows in WPS Spreadsheet

WPS Spreadsheet can combine same-width data ranges and filter rows containing a search value. Use a dynamic array formula when supported, or apply the same logic with helper columns for older versions.

  1. 1. Open the workbook in WPS Spreadsheet: Launch WPS Spreadsheet, open the .xlsx workbook, and verify that the source arrays have matching column counts.
  2. 2. Create one combined array: Select an empty output cell and use the supported VSTACK formula to place the arrays beneath one another, such as =VSTACK(myArrA,myArrB).
  3. 3. Filter rows containing the search text: In the output area, use FILTER with SEARCH to return matching rows, such as =FILTER(VSTACK(myArrA,myArrB),BYROW(VSTACK(myArrA,myArrB),LAMBDA(r,OR(ISNUMBER(SEARCH(SEARCHTXT,r))))))).
  4. 4. Limit the search to one column when required: Use CHOOSECOLS inside SEARCH, for example =FILTER(all,ISNUMBER(SEARCH(SEARCHTXT,CHOOSECOLS(all,2)))), and replace 2 with the target column number.
Search multiple data arrays and return complete matching rows in one result areaUse familiar spreadsheet formulas to filter text across all columns or a selected columnOpen and edit Microsoft Excel .xlsx workbooks with compatible formatting and formulasWork in a lightweight spreadsheet interface without changing the source arrays
microsoft office alternative - wps office

Frequently Asked Questions

How can I search all columns in multiple arrays and return complete rows?

Combine the arrays with VSTACK, then use FILTER with BYROW and SEARCH: =LET(all,VSTACK(myArrA,myArrB),FILTER(all,BYROW(all,LAMBDA(row,OR(ISNUMBER(SEARCH(SEARCHTXT,row))))))).

How do I search only column 2 of the combined arrays?

Use CHOOSECOLS to isolate the target column: =LET(all,VSTACK(myArrA,myArrB),FILTER(all,ISNUMBER(SEARCH(SEARCHTXT,CHOOSECOLS(all,2))))). Change 2 to the required column number.

Are SEARCH and FIND interchangeable in this formula?

No. SEARCH ignores letter case and supports wildcard characters, while FIND is case-sensitive and does not treat wildcards the same way.

What happens if no row contains the search text?

FILTER can return a #CALC! error when there are no matches. Add a third argument, such as FILTER(array,include,"No matches"), to display a custom message.

What if VSTACK or BYROW is unavailable?

These functions require a newer Microsoft 365 or compatible spreadsheet version. In an older version, combine the source ranges manually and use helper columns to test each row before copying matching rows into a result area.