Function Problems

How to Filter a 2D Excel Array When an Adjacent Row Has Data

Maira MehtabMaira Mehtab Nov 11, 2026 869 views

Question details

The user needs to filter a specific Excel column based on the presence of data in the corresponding rows of an adjacent 2D array.

How to Filter a 2D Excel Array When an Adjacent Row Has Data
Product
Microsoft Excel (Microsoft 365)
Device & OS
not provided
Scenario
Filtering data dynamically based on the contents of an adjacent multi-column range.
Observed behavior
The user wants a formula to output only the column entries where the corresponding 2D array row is not entirely blank.
Before you start

Ensure you are using a spreadsheet software version that supports dynamic array functions like FILTER, BYROW, and LAMBDA, such as Microsoft 365 or the latest WPS Office update.

Solution 1Recommended

Use the FILTER, BYROW, and LAMBDA Functions

Combine dynamic array functions to check each row for data and filter the target column accordingly.

This method leverages the BYROW function to evaluate each row in the 2D array using a custom LAMBDA formula. The COUNTA function determines if a row has any data, and FILTER extracts the corresponding values from the target column.

1
Select the target cell

Click on the cell where you want the filtered results to begin spilling.

2
Enter the FILTER formula

Type the formula =FILTER(B9:B13, BYROW(C9:F13, LAMBDA(r, COUNTA(r)<>0)), ""), adjusting B9:B13 to your target column and C9:F13 to your 2D array.

3
Apply the formula

Press Enter to execute the formula. The filtered results will automatically populate the cells below.

Use the FILTER, BYROW, and LAMBDA Functions
Dynamic Arrays: Because this formula uses dynamic arrays, ensure there is enough empty space below the entry cell for the results to spill without encountering a #SPILL! error.
Efficient Data Filtering

Filter Complex Arrays Effortlessly in WPS Spreadsheet

WPS Spreadsheet fully supports advanced array functions like FILTER, making it incredibly easy to manage and analyze your data sets. You can achieve exactly the same results seamlessly and for free.

  1. 1. Open your workbook: Launch WPS Office and open your spreadsheet document containing the 2D array.
  2. 2. Input the formula: Select a blank cell and input the exact =FILTER(B9:B13, BYROW(C9:F13, LAMBDA(r, COUNTA(r)<>0)), "") formula.
  3. 3. Get your results: Press Enter. WPS Spreadsheet will calculate and spill the filtered results perfectly just like Microsoft 365.
Fully supports advanced dynamic array functions like FILTER and BYROWHighly compatible with Microsoft Excel formulas and formats (XLSX)Lightweight application that runs smoothly on all devicesFree to use for everyday data analysis and management
microsoft office alternative - wps office

Frequently Asked Questions

Can I use this formula in older versions of Excel?

No, functions like BYROW, LAMBDA, and FILTER are dynamic array functions introduced in Microsoft 365 and Excel 2021. Older versions do not support them natively.

What if I want to filter based on a specific value rather than just any data?

You can modify the LAMBDA function condition. For example, to check if a row contains the number 5, you could use =FILTER(B9:B13, BYROW(C9:F13, LAMBDA(r, COUNTIF(r, 5)>0)), "").

Why am I getting a #SPILL! error?

A #SPILL! error occurs when the formula's output range is blocked by existing data. Clear the cells below the formula so the array can expand.

Can I filter multiple columns instead of just one?

Yes. Simply change the first argument of the FILTER function from a single column (like B9:B13) to a wider range (like A9:B13), and the formula will return all specified columns for the matching rows.