How to Combine Cells With Comma in Excel

So earlier we had CONCAT, and CONCATENATE function to concatenate multiple cells. But if we wanted to supply a range for joining cells with a delimiter (say a comma) then it is really tricky with these functions. But now Excel has introduced a new function called TEXTJOIN Function that can be used to concatenate ranges with a lot more flexibility. 

In this article, we will learn how to concatenate cell values of a range with comma using TEXTJOIN function. For users who don't have this function we will discuss other methods of concatenating range values with comma.\

Generic Formula


Comma (",") : This is the delimiter we want to use. Since in this article we are concentrating on concatenating cells with commas. 

TRUE : For ignoring blank cells in the range. 

Text_range1 : This is the range whose cells have values you want to concatenate.

[Text_range2] : The other ranges if you want to join in the text with commas. 

Let’s see an example to make things clear.

Example: Join Cell Values of Ranges With Comma as Delimiter

Here, we have some values in range B2:E8. We need to join the texts of each cell in a row.

Let's implement the formula we have and drag it down.


You can see that we have a string which is a result of concatenation of texts with commas.

Let's say if you want to concatenate the range B3:E3 and B7:E7. So the formula will be:


It will concatenate all the texts ignoring the blank cells.

How does it work?

The formula is simple. The TEXTJOIN function requires the delimiter with which you want to join text with. The second variable is set to be true so that it ignores the blank cells.

Now if any cell has invisible values like space then you will see an extra comma in between the joined text.

To avoid spaces, use the TRIM function to strip them out.


Concatenating Cells with Commas in Excel 2016 and Older

The problem is that the TEXTJOIN function is only available to Excel 2019 and 365. So if you want to concatenate the cells with commas, we'll need to use a trick.

So to concatenate cells in a row with commas do this.

In a cell, write "=" to start the formula and select the range as shown below.

Now press F2 and select the range in the formula bar or cell.

Press F9 key.

Now remove the equals and curly braces. You have the cells joined with commas.

But this way is not that effective for too many operations. 

So do we have any other way to combine texts with a given delimiter in Excel? The other way is the VBA way. Let's create one UDF to do this.

Function JoinText(delimiter As String, rng As Range)

Dim res As String

For Each cell In rng
 If Trim(cell.Value) <> "" Then
  res = res & Trim(cell.Value) & delimiter
 End If

Next cell
res = Left(res, Len(res) - 1)

JoinText = res

End Function

Press CTRL+F11 to open the VB Editor. Right click on the workbook and insert a module. Copy the code above and paste in the module's code area.

Now use this formula to join text with any delimiter you want to.

This formula will work in any version of Excel. You can download the workbook below to use this formula immediately.

So yeah guys, this is how you can join text with comma delimiter in Excel. I hope it was helpful for you. If you have any questions regarding this topic or any other excel related topic, ask in the comments section below. Till then keep Excelling.

Related Articles:

Split Numbers and Text from String in Excel 2016 and Older: When we didn't have TEXTJOIN function we used LEFT and RIGHT functions with some other functions to split numeric and nonnumeric characters from a string. 

Extract Text From A String In Excel Using Excel's LEFT And RIGHT Function: To remove text in excel from string we can use excel's LEFT and RIGHT function. These functions help us chop strings dynamically.

Remove leading and trailing spaces from text in Excel: Leading and trailing spaces are hard to recognize visually and can mess up your data. Stripping these characters from the string is a basic and most important task in data cleaning. Here's how you can do it easily in Excel.

Remove Characters From Right: To remove characters from the right of a string in Excel, we use the LEFT function. Yes, the LEFT function. The LEFT function retains the given number of characters from LEFT and removes everything from its right.

Remove unwanted characters in Excel: To remove unwanted characters from a string in Excel, we use the SUBSTITUTE function. The SUBSTITUTE function replaces the given characters with another given character and produces a new altered string.

How to Remove Text in Excel Starting From a Position in Excel: To remove text from a starting position in a string, we use the REPLACE function of Excel. This function help us determine the starting position and number of characters to strip.

Popular Articles:

50 Excel Shortcuts to Increase Your Productivity | Get faster at your task. These 50 shortcuts will make you work even faster on Excel.

How to use Excel VLOOKUP Function| This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets. 

How to use the Excel COUNTIF Function| Count values with conditions using this amazing function. You don't need to filter your data to count specific values. Countif function is essential to prepare your dashboard.

How to Use SUMIF Function in Excel | This is another dashboard essential function. This helps you sum up values on specific conditions.

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.