# How to list the column headers of cells marked with an X in Excel

Return the header wherever the row has an X and join the results: `=TEXTJOIN(", ",TRUE,IF(B2:F2="X",B$1:F$1,""))`, filled down.

**Excel:** `=TEXTJOIN(", ",TRUE,IF(B2:F2="X",B$1:F$1,""))` (Excel 2019 and later, including Microsoft 365)

**Google Sheets:** `=ARRAYFORMULA(TEXTJOIN(", ",TRUE,IF(B2:F2="X",B$1:F$1,"")))`

## Example

Sample data (row 1 is the header):

| A | B | C | D | E | F | G |
| --- | --- | --- | --- | --- | --- | --- |
| Employee | Excel | SQL | Python | Tableau | Power BI | Skills |
| Hannah | X | X |  | X |  |  |
| Victor | X |  | X |  | X |  |
| Mei |  | X | X |  |  |  |
| Jonas | X |  |  |  |  |  |
| Fatima | X | X | X | X | X |  |

Formula in G2, filled to G6: `=TEXTJOIN(", ",TRUE,IF(B2:F2="X",B$1:F$1,""))`

Result: Excel, SQL, Tableau; Excel, Python, Power BI; SQL, Python; Excel; Excel, SQL, Python, Tableau, Power BI

## How it works

`IF(B2:F2="X",B$1:F$1,"")` walks along the row and returns the header above each X and an empty string elsewhere. TEXTJOIN joins the list with ", " and its TRUE skips the empty strings. The `$` on row 1 keeps the headers in place as you fill down.

## Other ways

- `=TEXTJOIN(", ",TRUE,FILTER(B$1:F$1,B2:F2="X",""))`: FILTER keeps only the marked headers. Excel 2021 and Microsoft 365; in Google Sheets drop the third argument and wrap FILTER in IFERROR.

## Common mistakes

- "X" matches "x" too, because the comparison ignores case. A cell with " X" (with a space) doesn't match.
- For checkboxes, test TRUE instead: `IF(B2:F2=TRUE,…)`.
- In Excel 2019, confirm the formula with Ctrl+Shift+Enter before filling it down.

## Questions

**How do I list the employees who have one skill?**

Filter the names by that column: `=FILTER(A2:A6,C2:C6="X")`.

**How do I return headers where a number is above a limit?**

Change the test: `=TEXTJOIN(", ",TRUE,IF(B2:F2>100,B$1:F$1,""))`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/list-headers-of-marked-cells
