How to Add Commas Between Words in Excel (With Example)


You can use the following formula to add commas between words in Excel:

=SUBSTITUTE(TRIM(A2)," ",", ")

This particular formula adds commas between each word in cell A2.

The following example shows how to use this formula in practice.

Example: How to Add Commas Between Words in Excel

Suppose we have the following column in Excel that contains the names of basketball players on various teams:

Suppose we would like to add a comma in between the names in each row.

We can type the following formula into cell B2 to do so:

=SUBSTITUTE(TRIM(A2)," ",", ")

We can then click and drag this formula down to each remaining cell in column B:

Excel add comma between words

Column B now displays the names from each corresponding cell in column A with commas in between each name.

How This Formula Works

Recall the formula that we used to add commas in between the words in cell A2:

=SUBSTITUTE(TRIM(A2)," ",", ")

Here is how this formula works:

First, we use TRIM(A2) to remove all the spaces from the string in cell A2 except for the single spaces between the words.

Then we use the SUBSTITUTE function to substitute a single comma and a space for each occurrence of a single space.

We then repeat this same process for each cell in column A.

The end result is that we’re able to add commas between each word for each cell in column A.

Additional Resources

The following tutorials explain how to perform other common operations in Excel:

Excel: How to Extract Text Between Two Commas
Excel: How to Replace Commas with Line Breaks
Excel: Calculate Average of Numbers Separated by Commas

Leave a Reply

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