Function Problems

How to Return All Column Headers for Cells Containing 1 in Excel

Jason MillerJason Miller Oct 21, 2026 871 views

Question details

The user needs to retrieve and combine all column headers where the corresponding cell in a row contains the value 1, bypassing the single-match limitation of standard lookup formulas.

How to Return All Column Headers for Cells Containing 1 in Excel
Product
Excel
Device & OS
not provided
Scenario
Extracting multiple corresponding column headers for specific cell values across a dataset to categorize or summarize row data.
Observed behavior
Standard lookup functions like INDEX and MATCH only return the first matching column header, rather than returning every header where the criteria is met.
Before you start

Determine whether you are using a modern version of Excel (such as Microsoft 365 or Office 2021) that supports Dynamic Arrays and the FILTER function, or an older legacy version, as the optimal formula will differ significantly.

Solution 1Recommended

Use TEXTJOIN and FILTER in Modern Excel

Combine the TEXTJOIN and FILTER functions to easily return all matching column headers separated by a comma in a single cell. This is the most efficient method for modern Excel versions.

The FILTER function can extract an array of headers where the corresponding row values equal 1. By wrapping it in TEXTJOIN, you merge these results into a neat, comma-separated text string.

1
Select the destination cell

Click on the empty cell where you want the combined column headers to appear.

2
Enter the modern dynamic formula

Type the formula: =TEXTJOIN(", ", TRUE, FILTER($A$1:$D$1, A2:D2=1, "")). Replace $A$1:$D$1 with your actual absolute header range, and A2:D2 with the relative row data you are evaluating.

3
Apply and drag

Press Enter. The cell will display all matching column headers. You can click and drag the fill handle down to apply this formula to the remaining rows in your dataset.

Use TEXTJOIN and FILTER in Modern Excel
Dynamic Array Support: You do not need to use Ctrl+Shift+Enter for this formula in Microsoft 365 or Excel 2021, as they natively support dynamic arrays.
Advanced Spreadsheet Capabilities

Effortlessly Extract Multiple Headers with WPS Spreadsheet

WPS Spreadsheet fully supports dynamic arrays and modern functions like TEXTJOIN and FILTER. You can seamlessly process complex lookups and instantly return multiple matching values without struggling with complicated legacy array formulas.

  1. 1. Open your file in WPS: Launch WPS Spreadsheet and open your dataset containing the headers and row values.
  2. 2. Select the output cell: Click the blank cell where you want the matching headers to be combined.
  3. 3. Apply the modern formula: Type =TEXTJOIN(", ", TRUE, FILTER($A$1:$D$1, A2:D2=1, "")) into the formula bar.
  4. 4. Press Enter: Hit Enter on your keyboard. WPS Spreadsheet will instantly process the dynamic array and display all headers that meet the criteria.
Fully compatible with Microsoft Excel formulas (.xlsx and .xls)Natively supports modern functions including FILTER, TEXTJOIN, and XLOOKUPLightweight, fast-loading, and offers a highly familiar user interfaceCompletely free to use for your daily data analysis needs
microsoft office alternative - wps office

Frequently Asked Questions

Why does my INDEX and MATCH formula only return the first header?

The standard MATCH function is designed to stop searching as soon as it finds the very first value that meets your criteria. To return multiple matches, you must use array formulas or modern dynamic array functions like FILTER.

What does the #NAME? error mean when using FILTER or TEXTJOIN?

The #NAME? error indicates that the spreadsheet software does not recognize the function. This usually happens if you are using an older version of Excel (like Excel 2016 or earlier) that does not have TEXTJOIN or FILTER built into it. Consider upgrading or using a free modern alternative like WPS Office.

How do I return the headers if the cell contains specific text instead of the number 1?

You can easily modify the criteria in the formula. For example, if you want to find the text 'Yes', change A2:D2=1 to A2:D2="Yes" inside the FILTER or IF function.

Do I need to press Ctrl+Shift+Enter when using modern functions?

No, if you are using Microsoft 365, Excel 2021, or WPS Spreadsheet, dynamic arrays are natively supported. You only need to press Enter. Ctrl+Shift+Enter is only required for legacy array formulas in older versions.