- Purpose
- Join the text from several cells or ranges into one cell, with a delimiter between each item.
- Returns
- One text value. Empty text if there is nothing to join.
- Syntax
- Works in
- Excel 2019 and later · Microsoft 365 · Google Sheets · LibreOffice Calc
Arguments
| Argument | Required | What it is |
|---|---|---|
| delimiter | Yes | The text to put between items, in double quotes, such as ", " or "-". Use "" for nothing. |
| ignore_empty | Yes | TRUE to skip empty cells. FALSE to keep them, which leaves two delimiters in a row. |
| text1 | Yes | The first cell, range or text value to join. |
| text2, … | No | More cells, ranges or text values, up to 252 text arguments in total. |
Example: list the items of an order in one cell
The three item cells in B2 to D2 are joined with a comma and a space between them. C2 is empty and the second argument is TRUE, so it is skipped and no extra comma appears.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Order | Item 1 | Item 2 | Item 3 | Items |
| 2 | 1001 | Tea | Mug | Tea, Mug | |
| 3 | 1002 | Coffee | Filter | Grinder | Coffee, Filter, Grinder |
| 4 | 1003 | Kettle | Kettle | ||
| 5 | 1004 | Cocoa | Whisk | Cocoa, Whisk | |
| 6 | 1005 | Tea | Strainer | Honey | Tea, Strainer, Honey |
Build your TEXTJOIN formula
Fill in the fields with your own cells. The formula updates as you type.
Joins the values in A2:A10 into one cell with ", " between them, skipping empty cells.
Paste the formula into cell E2 or any empty cell. The coloured parts match the coloured fields. Using a different list separator? Replace the commas with semicolons.
How TEXTJOIN works
TEXTJOIN reads the cells you give it in order, left to right and then top to bottom, and writes their contents into one text value. Between each pair of items it inserts the delimiter from the first argument.
Two features separate it from older ways of joining text:
- It accepts ranges.
B2:D2orA2:A50is one argument. You do not list every cell. - It can skip empty cells, so a gap in the data does not leave a stray comma behind.
The delimiter is written once. It can be a comma and a space, a dash, a line break, or empty text when you want nothing between items.
The result is always text, even when every joined cell holds a number.
The ignore_empty argument
The second argument controls what happens when a cell in the range is empty. Take three cells that hold Tea, nothing and Mug.
| Formula | Result |
|---|---|
=TEXTJOIN(", ", TRUE, B2:D2) |
Tea, Mug |
=TEXTJOIN(", ", FALSE, B2:D2) |
Tea, , Mug |
TRUE is right for lists that people will read. FALSE is right when position matters, for example when you build a line of delimited data where the second field must stay the second field.
A cell that contains a space is not empty. It is joined like any other text, and the result shows two delimiters with a space between them.
More examples
The first three use the example data above, with item names in columns B to D.
A different delimiter
=TEXTJOIN(" / ", TRUE, B3:D3)
returns Coffee / Filter / Grinder.
Keep the empty position
=TEXTJOIN(";", FALSE, A2:D2)
returns 1001;Tea;;Mug. The empty cell C2 leaves two semicolons in a row, so Mug stays in the fourth position.
One item per line
=TEXTJOIN(CHAR(10), TRUE, B2:B6)
returns Tea, Coffee, Cocoa and Tea on four lines in one cell. Turn on Wrap Text to see the line breaks.
Only the rows that match a condition
=TEXTJOIN(", ", TRUE, IF(A2:A20="East", B2:B20, ""))
returns a comma-separated list of the column B values on rows where column A is East. In Excel 2019, press Ctrl+Shift+Enter to confirm it.
Dates and text together
=TEXTJOIN(" ", TRUE, A2, "due", TEXT(B2, "d mmm yyyy"))
returns the text in A2, the word due, and the date in B2 written out, such as Invoice 118 due 5 Dec 2026.
Tips
- Include the space in the delimiter.
", "gives “Tea, Mug” and","gives “Tea,Mug”. - Number formats are not carried over. Dates, currency and percentages are joined as their stored values. Wrap each one in TEXT with the format you want.
- You can mix ranges, single cells and typed text in one formula, as the last example does.
- The result cannot exceed 32,767 characters. Past that, the formula returns #VALUE!.
- If the joined text will be read by another program, pick a delimiter that never appears inside the values.
- For a one-off change to delimiters in existing text, the find and replace tool is quicker than a formula.
TEXTJOIN, CONCAT or the & operator
Excel has four ways to join text. They differ in what they accept and where they work.
| Method | Takes ranges | Delimiter | Skips empty cells | Works in |
|---|---|---|---|---|
TEXTJOIN |
Yes | Written once | Optional | Excel 2019 and later |
CONCAT |
Yes | None | Not applicable | Excel 2019 and later |
CONCATENATE |
No, single cells only | Typed between every item | No | Every version |
& operator |
No, single cells only | Typed between every item | No | Every version |
Use TEXTJOIN when you are joining a range or need a delimiter. Use CONCAT when the pieces run together with nothing between them, such as a code built from three columns.
Use & for two or three cells, or when the file must open in Excel 2016 or earlier:
=A2&" "&B2
returns the contents of A2 and B2 with a space between them. With &, an empty cell still gets its delimiter, so you need an IF around each piece to avoid stray separators. That is the work TEXTJOIN does for you.
To go the other way and split one cell into several, use the text to columns tool.
Errors and fixes
| Error | Why it happens | Fix |
|---|---|---|
| #NAME? | The file is open in Excel 2016 or earlier, which does not have TEXTJOIN. | Open it in Excel 2019 or later, or join the cells with the & operator. |
| #VALUE! | The joined text is longer than 32,767 characters, the most a cell can hold. | Join a smaller range, or split the result across several cells. |
| Numbers where dates should be | TEXTJOIN joins the stored value of a cell and ignores its number format, so a date arrives as a serial number such as 46354. | Wrap the cell in TEXT, for example TEXT(B2, "yyyy-mm-dd"). |
| Doubled delimiters | The second argument is FALSE, or the cells that look empty contain a space. | Set the second argument to TRUE and clear cells that hold only spaces. |
Questions
Why does TEXTJOIN show #NAME?
The version of Excel that opened the file does not have the function. TEXTJOIN needs Excel 2019 or later, or Microsoft 365. In Excel 2016 and earlier, join cells with the & operator: =A2&", "&B2.
What is the difference between TEXTJOIN and CONCAT?
Both accept ranges. TEXTJOIN puts a delimiter between items and can skip empty cells. CONCAT joins the items with nothing between them. Use TEXTJOIN for lists and CONCAT for running values straight together.
How do I join cells with a line break?
Use CHAR(10) as the delimiter: =TEXTJOIN(CHAR(10), TRUE, A2:A6). Then turn on Wrap Text for the cell, or the result shows on one line.
Can TEXTJOIN join only the cells that meet a condition?
Yes. Put an IF inside it: =TEXTJOIN(", ", TRUE, IF(A2:A20="East", B2:B20, "")) joins the column B values on rows where column A is East. In Excel 2019, confirm the formula with Ctrl+Shift+Enter.
Is there a limit to how much TEXTJOIN can join?
The result can be at most 32,767 characters, which is the limit for a single cell. A longer result returns #VALUE!. The function takes up to 252 text arguments, and each one can be a whole range.
How do I split joined text back into columns?
Use Text to Columns on the Data tab, with the same delimiter. You can also paste the text into the text to columns tool.