Skip to content
AnIntent

How to Join Cells in Excel With TEXTJOIN (and Skip the Blanks)

Use Excel's TEXTJOIN to combine cells with a comma or space, skip empty cells with TRUE, and avoid the 32,767-character #VALUE! error.

AnIntent Editorial · · 4 min read

Person working on a laptop with a spreadsheet outdoors
Photo by Gorilla ROI Data Connector on Unsplash
In this article
  1. The TEXTJOIN formula and its three required parts
  2. How to join a column into one cell, separated by commas
  3. Joining a few separate cells, such as first and last names
  4. Skipping blanks: what TRUE does and what Microsoft doesn't spell out
  5. Fixing the #VALUE! error from long results
  6. Which versions of Excel have TEXTJOIN
  7. Going the other way, or doing this in Google Sheets
Share this article

TEXTJOIN lets you combine a column or a row of cells in Excel into one cell, with a comma, space or any separator you choose between each value, and skip the empty cells so you don't get gaps in the list. Here's the formula, what each part does, and the main error to watch for.

The TEXTJOIN formula and its three required parts

According to Microsoft's TEXTJOIN help page, the function "combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value." The syntax is:

TEXTJOIN(delimiter, ignore_empty, text1, [text2], …)
  • delimiter (required): what goes between each value. Microsoft says this can be one or more characters in double quotes, a reference to a cell containing text, or an empty text string. A number is treated as text.
  • ignore_empty (required): set this to TRUE and empty cells are ignored. This is the part that skips the blanks.
  • text1 (required): a text string, or an array of strings such as a cell range.
  • text2, … (optional): more items to join.

Microsoft's own example joins separate words with a space:

=TEXTJOIN(" ",TRUE, "The", "sun", "will", "come", "up", "tomorrow.")

That returns The sun will come up tomorrow.

How to join a column into one cell, separated by commas

  1. Click the empty cell where you want the combined text.
  2. Type the formula, pointing it at your range. To join A2 through A8 with a comma and a space, skipping blanks:
=TEXTJOIN(", ", TRUE, A2:A8)
  1. Press Enter.

The delimiter here is ", ", a comma followed by a space, so the result reads like a normal list. Use "; " if you are pasting addresses into an email client that expects semicolons, or " " for a plain space.

The range doesn't have to be a single column. Microsoft's page also lists this example that takes in two columns at once:

=TEXTJOIN(", ", TRUE, A2:B8)

Joining a few separate cells, such as first and last names

You can list cells one by one as text1, text2 and so on instead of a range. For a first name in A2 and a last name in B2:

=TEXTJOIN(" ", TRUE, A2, B2)

For a "City, State" string from B2 and C2:

=TEXTJOIN(", ", TRUE, B2, C2)

With ignore_empty set to TRUE, an empty cell is left out rather than joined in. Fill the formula down the column to repeat it for every row.

Skipping blanks: what TRUE does and what Microsoft doesn't spell out

Microsoft's documentation describes only the TRUE case: empty cells are ignored. For most lists, such as mailing lists, tags or names with a missing middle name, TRUE is the setting you want.

One more option from the same page: if you set the delimiter to an empty text string (""), TEXTJOIN effectively just concatenates the ranges with nothing in between.

Fixing the #VALUE! error from long results

The most common way a TEXTJOIN formula breaks on a big range is length. Microsoft says that if the result exceeds 32,767 characters, which is the cell limit, TEXTJOIN returns #VALUE!.

If you hit this:

  • Join smaller ranges in separate cells, for example one TEXTJOIN per block of rows, so each result stays under the limit.
  • Check whether you meant to include the whole column. A reference like an entire column can pull in far more text than you expected.
  • If you'd rather show a message than an error, wrap the formula in IFERROR. See how to use IFERROR in Excel.

Which versions of Excel have TEXTJOIN

It tells Microsoft 365 subscribers to make sure they have the latest version of Office.

Going the other way, or doing this in Google Sheets

To split one cell back into several, use the reverse function: How to Split Text in Excel With TEXTSPLIT. If your data lives in Google Sheets instead, see How to Combine Cells in Google Sheets With TEXTJOIN.

Common questions

How do I make TEXTJOIN ignore blank cells?

Set the second argument to TRUE, for example =TEXTJOIN(", ", TRUE, A2:A8). Microsoft's help page says empty cells are then ignored.

Why does TEXTJOIN return #VALUE!?

Microsoft says TEXTJOIN returns #VALUE! when the result exceeds 32,767 characters, the maximum a cell can hold. Join smaller ranges to stay under it.

Can I join cells with no separator at all?

Yes. Use an empty text string as the delimiter, as in =TEXTJOIN("", TRUE, A2:A8). Microsoft says this effectively concatenates the ranges.

Which Excel versions include TEXTJOIN?

Microsoft's help page lists Office 2019 and Microsoft 365 on Windows or Mac, and asks Microsoft 365 subscribers to make sure they have the latest version.

Can the delimiter come from a cell?

Yes. Microsoft says the delimiter can be a reference to a valid text string, and a number used as the delimiter is treated as text.

Hands typing on a laptop displaying a data spreadsheet
How-to

How to List Unique Values in Excel With the UNIQUE Function

Use Excel's UNIQUE function to pull a deduplicated list from a range, sort it, and avoid the closed-workbook trap.

· 3 min

Keep reading