The TEXTJOIN function
TEXTJOIN turns a range into one piece of text with a separator between the items: a comma-separated list of attendees, an address on one line, or tags for an import file.
Its second argument decides what happens to blank cells. Set it to TRUE and they're skipped cleanly.
=TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)
Arguments
- delimiter
- What to put between each item, such as
", "or" ". - ignore_empty
- TRUE to skip empty cells, FALSE to keep them (which leaves doubled separators).
- text1
- The first cell, range or text to join.
- text2, ...optional
- More cells, ranges or text.
Try it
=TEXTJOIN(", ",TRUE,A2:A6) in D2. The four names are joined with a comma and space. The empty row is skipped.
D2
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Attendee | Paid | Guest list | Address | |||
| 2 | Amira | Yes | Amira, Ben, Chloe, Dev | 4 Mill Lane | |||
| 3 | Ben | No | Hebden Bridge | ||||
| 4 | HX7 8AB | ||||||
| 5 | Chloe | Yes | |||||
| 6 | Dev | Yes | |||||
| 7 | |||||||
| 8 |
Edit the formula in D2, or change the data, and press Enter.
More examples
| Formula | Result | What it does |
|---|---|---|
| =TEXTJOIN(", ",FALSE,A2:A6) | Amira, Ben, , Chloe, Dev | With FALSE the blank cell is kept, leaving an empty slot. |
| =TEXTJOIN(", ",TRUE,F2:F4) | 4 Mill Lane, Hebden Bridge, HX7 8AB | An address on one line, ready for a label. |
| =TEXTJOIN(", ",TRUE,FILTER(A2:A6,B2:B6="Yes")) | Amira, Chloe, Dev | FILTER keeps only the paid rows, and TEXTJOIN lists them. |
Tips
- Use
CHAR(10)as the delimiter for one item per line, with Wrap Text turned on. - Combine with FILTER or UNIQUE to join only some values:
=TEXTJOIN(", ",TRUE,UNIQUE(A2:A20)). - Set ignore_empty to TRUE unless you specifically need placeholders for blanks.
Common mistakes
- The list has doubled commas.The second argument is FALSE, so blanks are kept. Change it to TRUE.
- You wrote `=TEXTJOIN(A2:A6, ", ")`.The delimiter comes first, then TRUE/FALSE, then the cells.
- Numbers lose their £ or date format.TEXTJOIN uses stored values. Format them with TEXT inside the formula.
Practise TEXTJOIN with instant feedback
Type real formulas into a working spreadsheet and get told straight away whether they work.