What TEXTJOIN does

TEXTJOIN joins text from many cells into one, with the same separator between every item, and it can skip empty cells. Point it at a column of names with ”, ” as the separator and you get “Ana, Ben, Cleo, Dan”, ready for an email or a report.

Its second argument decides what happens to empty cells. With TRUE they’re skipped, so a list with gaps still comes out clean, without doubled commas. With CONCAT you’d add every separator yourself and deal with each gap by hand.

Syntax

=TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)
Arguments in square brackets are optional; the rest are required.
delimiterRequired
What goes between the items, in quotation marks: ", " for a comma and a space, "; " or " | ". Use "" for nothing.
ignore_emptyRequired
TRUE skips empty cells, so you never get two separators in a row. FALSE keeps them, which leaves a gap for every empty cell.
text1Required
The first cell, range or text to join, such as A2:A6.
text2Optional, can repeat
More cells, ranges or texts, joined in the order you list them, up to 252 in all.

Example: a list of attendees

The names are in A2 to A6, and one place hasn’t been filled.

TRUE skips the empty A4, so there's no double comma. In C2, =TEXTJOIN(", ",TRUE,A2:A6) returns Ana, Ben, Cleo, Dan.

Example: an address on one line

The address parts are in B1 to B4, and the second line of the street address is often empty.

The empty Line 2 is left out of the address. In B6, =TEXTJOIN(", ",TRUE,B1:B4) returns 14 Harbor St, Portland, 97201.

TEXTJOIN with a condition

To join only some of the rows, such as the attendees who confirmed or every order from one customer, give TEXTJOIN a filtered list. With the names in A2:A9 and Yes or No in B2:B9:

  • In Microsoft 365 and Excel 2021 or later, FILTER keeps the matching rows: =TEXTJOIN(", ",TRUE,FILTER(A2:A9,B2:B9="Yes","")). The "" at the end makes the result empty text, instead of an error, when no row matches.
  • In Excel 2019, IF does the same job: =TEXTJOIN(", ",TRUE,IF(B2:B9="Yes",A2:A9,"")). Confirm it with Ctrl+Shift+Enter (Cmd+Shift+Return on a Mac), which makes it an array formula.

Common mistakes

  • With FALSE as the second argument, an empty cell still gets its separator, so the attendee list reads “Ana, Ben, , Cleo, Dan”.
  • A cell holding a space isn’t empty, so TRUE doesn’t skip it and the list gets a gap. Clean the column with TRIM.
  • "," gives “Ana,Ben,Cleo”. For a readable list, use ", ".
  • Dates and formatted numbers join as plain numbers, so a date becomes something like 46096. Format them inside the formula with the TEXT function.
  • TEXTJOIN isn’t in Excel 2016 or earlier, where it shows #NAME?.

Frequently asked questions

What is the difference between TEXTJOIN and CONCAT?

CONCAT joins exactly what you give it, so you add every separator yourself. TEXTJOIN puts the same separator between all the items and can skip empty cells.

How do I use TEXTJOIN with IF?

Put IF inside TEXTJOIN so only the matching rows give their text: =TEXTJOIN(", ",TRUE,IF(B2:B9="Yes",A2:A9,"")). Microsoft 365 needs only Enter; in Excel 2019, confirm it with Ctrl+Shift+Enter (Cmd+Shift+Return on a Mac).

Can TEXTJOIN join more than one range?

Yes. List them one after another: =TEXTJOIN(", ",TRUE,A2:A6,C2:C6) joins the first range, then the second.

How do I add a line break with TEXTJOIN?

Use CHAR(10) as the separator and turn on Wrap Text for the cell: =TEXTJOIN(CHAR(10),TRUE,A2:A6).

Is there a limit to how long the result can be?

Yes. A cell holds at most 32,767 characters, and TEXTJOIN shows #VALUE! when the joined text would be longer.