Function Problems

How to Use FILTER to Check Groups of Rows in Google Sheets

Algirdas JasaitisAlgirdas Jasaitis Nov 10, 2026 868 views

Question details

The user wants to evaluate columns across a full data range and dynamically keep columns that contain data, avoiding the need to add multiple row conditions manually.

How to Use FILTER to Check Groups of Rows in Google Sheets
Product
Google Sheets
Device & OS
not provided
Scenario
Filtering a dataset horizontally to extract headers or values from columns that have at least one non-empty cell in a specified group of rows.
Observed behavior
Looking for a compact formula solution using functions like BYCOL and COUNTA to test entire columns across a large data range at once.
Before you start

Ensure your dataset is organized with a clear header row and that the data ranges you plan to evaluate have matching column dimensions.

Solution 1Recommended

Use FILTER, BYCOL, and LAMBDA to Filter Columns Dynamically

Combine the FILTER function with BYCOL, LAMBDA, and COUNTA to evaluate entire columns in a single compact formula, returning only the columns that contain data.

The BYCOL function allows you to apply a LAMBDA formula to every column in an array. By nesting COUNTA inside the LAMBDA, you can check if a column has any non-empty cells. The FILTER function then uses this logical array to include or exclude those columns from your final result.

1
Identify your data ranges

Determine the header row you want to return (e.g., A1:J1) and the data range containing the rows you want to check for data (e.g., A2:J1000).

2
Enter the formula

Click on an empty cell where you want the filtered headers to appear and type the following formula: =FILTER(A1:J1, BYCOL(A2:J1000, LAMBDA(col, COUNTA(col))))

3
Adjust the ranges

Modify the A1:J1 and A2:J1000 references in the formula to match the exact dimensions of the data in your spreadsheet.

4
Review the results

Press Enter. The formula will dynamically spill across adjacent cells, returning only the headers or row values for columns that contain at least one non-empty cell in the checked rows.

Use FILTER, BYCOL, and LAMBDA to Filter Columns Dynamically
Dynamic Updates: If you add data to a previously empty column within the checked range later on, the FILTER result will automatically update to include that column.
Advanced Data Processing with WPS Spreadsheet

Efficiently Filter and Analyze Data with WPS Office

WPS Spreadsheet offers powerful built-in filtering tools and comprehensive function support, allowing you to manage large datasets effortlessly without relying solely on complex array formulas.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office, select Spreadsheet, and open your data file containing the rows and columns you want to filter.
  2. 2. Apply AutoFilter: Navigate to the 'Data' tab on the ribbon and click on 'AutoFilter' to easily hide empty rows or columns based on specific criteria.
  3. 3. Use Advanced Filter: For complex row checking, click on the 'Advanced Filter' feature under the Data tab to set up multiple conditions without writing lengthy array formulas.
  4. 4. Utilize built-in functions: Leverage WPS Spreadsheet's extensive supported lookup and array functions to manipulate, query, and extract your required data ranges seamlessly.
Fully compatible with Microsoft Excel file formats (.xlsx, .xls, .csv)Intuitive AutoFilter and Advanced Filter interfaces for quick data extractionRich library of logical, lookup, and math functions for complex data analysisLightweight, fast, and completely free to use for daily spreadsheet tasks
QA img-9

Frequently Asked Questions

Why does my FILTER formula return an error?

An error typically occurs if the dimensions of the header range (e.g., A1:J1) do not match the number of columns in the data range being evaluated (e.g., A2:J1000). Ensure both ranges span the exact same columns.

What does the LAMBDA function do in this formula?

The LAMBDA function acts as a custom, anonymous function inside BYCOL. It defines a variable (`col`) for each column and applies the COUNTA function to it, allowing the formula to evaluate each column individually without manual repetition.

Can I use this formula to check for specific text instead of just non-empty cells?

Yes. You can replace COUNTA(col) with a condition like COUNTIF(col, "TargetText") > 0 within the LAMBDA function to return only the columns that contain your specific target values.

Are the BYCOL and LAMBDA functions available in all spreadsheet software?

BYCOL and LAMBDA are modern dynamic array functions available in Google Sheets and newer versions of Microsoft Excel (Microsoft 365). They may not be supported in older desktop versions of spreadsheet software.