Microsoft 365 Excel: Search Multiple Two-Dimensional Arrays and Return Matching Rows
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.
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.
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.
Define or confirm two same-width arrays, such as myArrA and myArrB, and place the search value in the named range SEARCHTXT.
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.
Extend the VSTACK section, for example VSTACK(myArrA,myArrB,myArrC), while keeping the FILTER and BYROW portions unchanged.
Search only a selected column in the combined arrays
Use this variation when the search should be limited to one column instead of the entire row.
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. Open the workbook in WPS Spreadsheet: Launch WPS Spreadsheet, open the .xlsx workbook, and verify that the source arrays have matching column counts.
- 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. 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. 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.

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.




