TEXTJOIN
TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...) joins text values or a whole range into one string with a separator between them, and with ignore_empty set to TRUE it skips blank cells. =TEXTJOIN(", ", TRUE, A2:A10) turns a column into a comma-separated list. It needs Excel 2019 or Microsoft 365.
Syntax
TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)| Part | What it is |
|---|---|
delimiter | The text to put between items: ", ", " ", "; " or "" for nothing. |
ignore_empty | TRUE to skip blank cells, FALSE to keep an empty slot (two delimiters in a row). |
text1, text2... | Cells, ranges or arrays to join, up to 252 arguments. |
Examples
=TEXTJOIN(", ", TRUE, A2:A5)Result: red, green, blue when A2:A5 holds red, green, (empty), blue
=TEXTJOIN(" ", TRUE, B2, C2, D2)Result: First, middle and last name with single spaces, even when the middle name is blank
=TEXTJOIN("; ", TRUE, IF(A2:A100 = "North", B2:B100, ""))Result: The names in B for every North row, separated by semicolons
In Excel 2019 confirm with Ctrl+Shift+Enter; in 365 it works as typed.
=TEXTJOIN(CHAR(10), TRUE, A2:A4)Result: The three cells on separate lines, when the cell has Wrap Text turned on
Common mistakes
- #NAME?: TEXTJOIN does not exist in Excel 2016 or earlier. Use CONCATENATE or & in those versions.
- Double delimiters appear: ignore_empty is FALSE or the blanks contain spaces. Set it to TRUE and TRIM the source.
- #VALUE!: the result is longer than 32,767 characters, the cell limit.
- Numbers lose formatting when joined; wrap them in TEXT first, for example TEXT(B2, "0.00").
Practice TEXTJOIN
These drills check your answer on live data, free, no account needed.
- Join the tagsJoin the tags in A2:D2 into one cell, separated by a comma and a space, skipping empty cells. Answer in E2.
Questions
How do I combine a column into one cell separated by commas?
=TEXTJOIN(", ", TRUE, A2:A100). The TRUE skips empty cells so you get no stray commas.
What is the difference between TEXTJOIN and CONCAT?
CONCAT joins with no separator and cannot skip blanks. TEXTJOIN takes a delimiter and an ignore-empty switch, which is what you want for lists.
How do I TEXTJOIN with a condition?
Put an IF inside: =TEXTJOIN(", ", TRUE, IF(condition_range = value, return_range, "")). Or use FILTER in Microsoft 365: =TEXTJOIN(", ", TRUE, FILTER(B2:B100, A2:A100 = "North")).
Related
- CONCAT and &How to join text in Excel with CONCAT, CONCATENATE and the & operator, with examples for full names, email addresses, numbered IDs and a formatted date.
- FILTERHow the Excel FILTER function returns all the rows of a range that meet a condition, with examples for one criterion, AND and OR, a not found value and SORT.
- UNIQUEHow the Excel UNIQUE function returns a list without duplicates that spills down the sheet, with examples for a distinct list, a distinct count and a sort.
- TEXTHow the Excel TEXT function turns a number or date into text in a format you choose, with examples for dates, thousand separators, percentages and padding.