The TEXTJOIN function

Joins texts with a delimiter between them, and can skip empty cells.

Syntax

TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)
delimiter
The text to put between items, such as ", ".
ignore_empty
TRUE to skip empty cells.
text1
The first text, cell or range.
text2 (optional)
More texts or ranges.

Examples

D1=TEXTJOIN(", ",TRUE,A2:A4)
ABCD
1FruitPriceApple, Pear, Plum
2Apple4
3Pear6
4Plum5

In plain words: Join the fruit in A2:A4 with a comma and a space between them, skipping empty cells.

D1=TEXTJOIN("-",TRUE,"DK","","2100")
ABCD
1FruitPriceDK-2100
2Apple4
3Pear6
4Plum5

Read the guide

Related functions