ShareYourGroupShareYourGroupExcel Formulas

Text functions

TEXTJOIN function in Excel

TEXTJOIN joins text from several cells or ranges with a separator between the items, and can skip empty cells.

TEXTJOIN is the function to use when several cells must become one text with the same separator between them: a list of names with commas, the parts of an address, the lines of a postal label. It is available in Excel 2019, Excel 2021 and Microsoft 365.

Syntax

=TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)
ArgumentWhat it is
delimiterThe separator to put between items, such as ", " or "-". Use "" for none.
ignore_emptyTRUE to skip empty cells. FALSE to include them, which leaves two separators together.
text1, text2, ...The cells, ranges or texts to join.

Examples

Each result below is what Excel itself showed for the formula on the sample sheet.

Sample sheet: Marks of eight students in three subjects. One Science mark is missing (cell D6 is empty).
ABCDE
1NameClassMathsScienceEnglish
2Asha8A788591
3Ravi8B455260
4Meena8A928879
5Kabir8B334138
6Tara8A6772
7Joy8B889084
8Neha8A546158
9Imran8B787369

How it works

The first argument is the separator. The second says what to do about empty cells. Everything after that is joined in order, and the separator is placed between items, never at the start or the end.

Compare it with joining by hand. For five cells, =A2&", "&B2&", "&C2&", "&D2&", "&E2 is long, and if C2 is empty it produces ", ," in the middle. =TEXTJOIN(", ",TRUE,A2:E2) is short and handles the gap.

Skipping empty cells

Set the second argument to TRUE in nearly every case. It is what makes TEXTJOIN ideal for addresses, where a second address line or a landmark is often missing:

=TEXTJOIN(", ", TRUE, B2:F2)

gives "12 Model Town, Ludhiana, Punjab" without stray commas, whichever parts are blank.

Cells that contain a formula returning "" count as empty and are skipped too. That is the trick behind the conditional example.

Joining only some rows

TEXTJOIN joins whatever it is given, so the selecting is done by another function inside it.

This answers a very common request: "list all the items for this customer in one cell".

Add UNIQUE to remove repeats and SORT to put the list in order: =TEXTJOIN(", ",TRUE,SORT(UNIQUE(C2:C13))).

Line breaks as the separator

Use CHAR(10) as the separator to put each item on its own line inside the cell: =TEXTJOIN(CHAR(10),TRUE,A2:A5). Switch on Wrap Text for the cell to see the lines.

Numbers and dates

As with all text joining, numbers and dates lose their formatting. Wrap the range in TEXT: =TEXTJOIN(", ",TRUE,TEXT(A2:A5,"dd-mmm")).

Limits

A cell can hold 32,767 characters. If the joined text would be longer, TEXTJOIN returns #VALUE!.

Common mistakes

In Google Sheets

TEXTJOIN is available in Google Sheets with the same three-part layout. Sheets also has JOIN, a simpler version with no option for empty cells.

Related functions

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.