Function Problems

How to Create a List of Headers for Non-Empty Excel Columns

John WilsonJohn Wilson Nov 4, 2026 869 views

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.

How to Create a List of Headers for Non-Empty Excel Columns
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the target cell

Click on the destination cell where you want the list of headers to appear (for example, cell H2).

2
Enter the formula

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.

3
Confirm the formula

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.

4
Apply to other rows

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.

Use TEXTJOIN and IF Array Formula
Array Formula Requirement: If you see a #VALUE! error in older Excel versions, it indicates that the array was not evaluated correctly. You must confirm the formula by pressing Ctrl+Shift+Enter.
Advanced Spreadsheets

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. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your activity table.
  2. 2. Select the destination cell: Click on the cell where you want to list the extracted team-member headers.
  3. 3. Enter the formula: Type =TEXTJOIN(",",TRUE,IF(B2:G2>0,$B$1:$G$1,"")) into the formula bar.
  4. 4. Confirm and drag: Press Enter (or Ctrl+Shift+Enter for array formulas) and drag the fill handle downwards to complete the column.
Fully compatible with Microsoft Excel (.xlsx) formatsSupports advanced functions like TEXTJOIN and FILTER nativelyLightweight and fast data processingClean and familiar user interface for seamless migration
microsoft office alternative - wps office

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.