How to Create a List of Headers for Non-Empty Excel Columns
Question details
The user needs to extract and list column headers into a single cell for a specific row where the cells are not blank or contain values greater than zero.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Managing an activity tracking table where team members are assigned work hours, and a summary column needs to display the names of all assigned members for each activity.
- Observed behavior
- The goal state is to automate the process of listing headers of non-empty cells into a single cell, separated by commas, rather than checking each column manually.
Ensure your version of Excel or WPS Spreadsheet supports the TEXTJOIN function, which is available in Office 365, Excel 2019, and newer versions. Check that your header row contains the correct names before applying the formulas.
Use TEXTJOIN and IF Array Formula
This method dynamically checks a row for non-empty values and concatenates the corresponding column headers into a single cell, separated by commas.
The TEXTJOIN function is ideal for this task because it can ignore empty strings and apply a delimiter, such as a comma, between the extracted headers.
By combining it with the IF function, you can evaluate which cells in a row meet your condition (e.g., greater than 0) and return the absolute references of the header row.
Click on the destination cell where you want the list of headers to appear (for example, cell H2).
Type the formula =TEXTJOIN(",",TRUE,IF(B2:G2>0,$B$1:$G$1,"")). Adjust the range B2:G2 to match your data row and $B$1:$G$1 to match your absolute header range.
Press Enter to apply the formula. If you are using an older version of Excel that relies on traditional array formulas, press Ctrl+Shift+Enter instead.
Click and drag the fill handle at the bottom-right corner of the cell downwards to apply the formula to the remaining rows in your table.

Combine TEXTJOIN with FILTER Function
If you are using a newer version of Excel (Office 365 or 2021+), the FILTER function offers a cleaner alternative to the IF array formula without requiring Ctrl+Shift+Enter.
Easily Extract Headers and Manage Data with WPS Spreadsheet
WPS Office Spreadsheet fully supports advanced functions like TEXTJOIN, IF, and array formulas. You can seamlessly execute complex data summaries, extract specific headers, and manage your tables just like in Excel, completely for free.
- 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your activity table.
- 2. Select the destination cell: Click on the cell where you want to list the extracted team-member headers.
- 3. Enter the formula: Type =TEXTJOIN(",",TRUE,IF(B2:G2>0,$B$1:$G$1,"")) into the formula bar.
- 4. Confirm and drag: Press Enter (or Ctrl+Shift+Enter for array formulas) and drag the fill handle downwards to complete the column.

Frequently Asked Questions
Why does my TEXTJOIN formula return a #NAME? error?
The #NAME? error typically occurs if your version of Excel does not support the TEXTJOIN function. It is natively available in Excel 2019, Office 365, and newer versions. Consider upgrading your software or using WPS Office, which fully supports this function.
Can I list headers based on cells containing text instead of numbers?
Yes. You can change the logical test in the IF function. To check for any non-blank text or value, replace >0 with <>". For example, use IF(B2:G2<>"", $B$1:$G$1, "").
How do I change the separator from a comma to a new line?
To change the separator, modify the first argument in the TEXTJOIN function. Instead of using ",", use CHAR(10) which represents a line break. The formula will look like =TEXTJOIN(CHAR(10),TRUE,IF(B2:G2>0,$B$1:$G$1,"")). Make sure to enable 'Wrap Text' on the cell to see the line breaks.




