Join text values with a delimiter
=TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)
| Parameter | Description |
|---|---|
delimiter |
Separator between each text. |
ignore_empty |
Whether to ignore empty cells or not. |
text1 |
First text value or range. |
text2 |
[optional] Second text value or range. |
Values are concatenated in the order they appear. With "Hello" in A1 and "World" in A2, the following formula returns "Hello World":
=TEXTJOIN(" ",TRUE,A1,A2) // returns "Hello World"
Changing the delimiter to a comma (", ") and reversing A1 and A2, we get "World, Hello":
=TEXTJOIN(", ",TRUE,A2,A1) // returns "World, Hello"
To join cells in the range A1:A3 with a comma and space, you can use TEXTJOIN like this:
=TEXTJOIN(", ",TRUE,A1:A3)
In the example below, TEXTJOIN is set up to concatenate names. Notice the cell reference for Title is provided first, followed by a range for First, M
=TEXTJOIN(" ",1,E3,B3:D3)
When concatenating numbers, number formatting is lost. For example, with the date 1-Jul-2021 in cell A1, and 2-Jul-2021 in A2, the dates revert to ser
=TEXTJOIN("-",1,A1,A2) // returns "44378-44379"
Use the TEXT function to apply formatting during concatenation:
=TEXTJOIN("-",1,TEXT(A1,"mmm d"),TEXT(A2,"mmm d")) // "Jul 1-Jul 2"