How to Convert Column to Row with Comma in Excel (3 Ways)

Method 1 – Using TEXTJOIN Function

Using the TEXTJOIN function is one of the most efficient ways to convert column to row with comma. The TEXTJOIN function returns a text string as output where the given text inputs are joined by a specified delimiter.

Steps:

  • Enter the following formula in cell C5.
=TEXTJOIN(",",TRUE,B5:B9)

The range B5:B9 represents the cells of the Item Name column.

  • Press ENTER.

Using TEXTJOIN Function to Convert Column to Row with Comma in Excel

The Item Name column will be converted to row with comma between each Item Name as shown in the following image.


Method 2 – Applying CONCAT Function

The CONCAT function can join texts from multiple ranges and strings.

Steps:

  • Enter the following formula in cell C5.
=CONCAT(B5:B9&",")
  • Press ENTER.

Applying CONCAT Function to convert column to row with comma in Excel

You will get the following output.


Method 3 – Utilizing VBA Code

Steps:

  • Go to the Developer tab from Ribbon.
  • Choose the Visual Basic option from the Code group.

Utilizing VBA Macro to Convert Column to Row with Comma in Excel

The Microsoft Visual Basic window will open.

  • In the Microsoft Visual Basic window, click on the Insert tab.
  • Choose the Module option from the drop-down.

  • Enter the following code in the newly created module.
Function row_with_comma(input_range As Range)
Dim output_row
Dim input_cell As Variant
For Each input_cell In input_range
If Not IsEmpty(input_cell.Value) Then
output_row = output_row & input_cell.Value & ","
End If
Next
row_with_comma = Left(output_row, Len(output_row) - 1)
End Function

 

writing VBA code to convert column to row with comma in Excel

  • Click on Save.

  • Press the keyboard shortcut ALT + F11 and you will be redirected to your worksheet.
  • Enter the following formula in cell C5.
=row_with_comma(B5:B9)
  • Press ENTER.

The texts from the Item Name column will be converted to row with a comma between each Item Name.


How to Convert Column to Semicolon Separated List in Excel

While working in Excel, we often need to convert columns to a list where the texts are separated by semicolons. We can fix this by using the TEXTJOIN function of Excel.

Steps:

  • Enter the following formula in cell C5.
=TEXTJOIN(";",TRUE,B5:B9)
  • Press ENTER.

The following output will be shown on your worksheet.

Read More: How to Change Semicolon to Comma in Excel


How to Convert Column to Comma Separated List with Single Quotes

In the following sample dataset, we will convert column to a comma separated list with single quotes.

How to Convert Column to Comma Separated List with Single Quotes

Steps:

  • Enter the following formula in cell C5.
=TEXTJOIN(",",TRUE,B5:B9)

The range B5:B9 indicates the cells of the Name column.

  • Press ENTER.

The Name column of the dataset will be converted to a comma separated list.


Download Practice Workbook


Related Articles


<< Go Back to How to Add Comma in Excel | Concatenate Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Zahid Hasan
Zahid Hasan

Zahid Hassan, BSc, Industrial and Production Engineering, Bangladesh University of Engineering and Technology, has worked with Exceldmy for 1.5 years. He has written 95+ articles for Exceldemy. He has worked as an Excel & VBA Content Developer. He also worked as a VBA Developer for the Template team. Currently, he is working as a Junior Software Developer for the Excel Add-in project. He is interested in Software Development, Python, VBA, VB.NET, and Data Science, expanding his expertise in... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo