Note: the new TEXTJOIN function is a better way to solve this problem. See below for more information. This part of the formula is annoyingly manual. To speed things up, copy &" “& to the clipboard before you start. Then follow this pattern: [click] [paste] [click] [paste] [click] [paste] until you get to the last cell reference. It actually goes pretty fast. The result of this concatenation (before TRIM and SUBSTITUTE run) is a string like this: Next, the TRIM function is used to “normalize” all spacing. TRIM automatically strips space at the start and end of a given string, and leaves just one space between all words inside the string. This takes care of extra spaces causes by empty cells. Finally, the SUBSTITUTE function is used to replace each space (” “) with a comma and space (”, “), returning text like this:

Joining cells with other delimiters

To join cells with another delimiter (separator), just adapt the “new_text” argument inside SUBSTITUTE. For example, to join cells with a forward slash, use: The output will look like this:

TEXTJOIN Function

The TEXTJOIN function is a new function available in Excel 365 and Excel 2019. TEXTJOIN allows you to concatenate a range of cells with a delimiter, and will can also be set to ignore empty cells. To use TEXTJOIN with the example above, the formula is:

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.