How to Use the TEXTJOIN Function in Excel for Dynamic String Concatenation

The Clunkiness of CONCATENATE

A very common task in Excel is taking data that is split across multiple columns and gluing it together into a single string of text.

For example, Column A has “John”, Column B has “Smith”, and you want Column C to say “John Smith”.

Historically, analysts used the CONCATENATE function, or the ampersand symbol (&).

=A1 & " " & B1

This works fine for two cells. But what if you need to glue together an entire row of 15 different cells (e.g., Address, City, State, Zip Code), separated by commas?

Writing =A1 & ", " & B1 & ", " & C1 & ", " & D1 is incredibly tedious. Worse, if cell C1 (Address Line 2) is blank, the ampersand method will still output the comma, resulting in an ugly output like: 123 Main St, , New York, NY.

To solve both the tedium of massive arrays and the problem of blank cells, Microsoft introduced the TEXTJOIN function.

The Syntax of TEXTJOIN

=TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)
  • delimiter: What you want to put between the words (e.g., a comma, a space, or a dash).
  • ignore_empty: A TRUE or FALSE boolean. If TRUE, it will completely ignore blank cells, preventing double-commas.
  • text1: The actual array or range of cells you want to glue together.

1. The Basic Array Join

To glue an entire row of 15 address cells together (A1 through O1), separated by a comma and a space, and ignoring any blank cells:

=TEXTJOIN(", ", TRUE, A1:O1)

Excel instantly grabs all 15 cells, strips out any empty ones, and outputs a perfectly formatted, single-line address string.

2. Creating Email Distribution Lists

TEXTJOIN isn’t just for rows; it works perfectly on massive vertical columns.

Suppose you have a list of 50 employee email addresses in Column A (cells A1 to A50). You need to copy those emails and paste them into Outlook’s “To:” line. Outlook requires emails to be separated by a semicolon (;).

You can instantly generate the perfect Outlook string using TEXTJOIN:

=TEXTJOIN(";", TRUE, A1:A50)

This generates a massive, single-line string of all 50 emails (e.g., [email protected];[email protected];[email protected]) that you can copy and paste directly into your email client.

3. Combining TEXTJOIN with IF Logic

The true superpower of TEXTJOIN is that, because it accepts dynamic arrays, you can wrap it around an IF statement to conditionally glue text together.

Suppose you have a list of Employee Names in Column A, and their Departments in Column B. You want to generate a single-line list of names, separated by commas, but only for employees in the “IT” department.

=TEXTJOIN(", ", TRUE, IF(B2:B100 = "IT", A2:A100, ""))

How it works:
The IF statement acts as a filter. If the department is “IT”, it passes the name to TEXTJOIN. If it is not “IT”, it passes a blank string (""). Because TEXTJOIN is set to TRUE (Ignore Empty), it completely ignores the blank strings, outputting a perfect, clean list of only the IT staff.

Conclusion

The TEXTJOIN function fundamentally modernizes text manipulation in Excel. By combining massive array processing with intelligent empty-cell ignoring and custom delimiters, it eliminates the fragile, repetitive concatenation formulas of the past.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.