How to Convert a Column into a Comma Separated List With Single Quotes – 5 Methods

 

Download Practice Workbook

Download the practice workbook to exercise.


The dataset contains information about stationery products. To convert the Product column into a comma separated list:

Convert Column to Comma Separated List With Single Quotes


Method 1 – Convert a Column into a Comma Separated List Manually

Use a formula, the ampersand sign (&) and comma (,).

Steps:

  • Enter the formula in C5.
="'"&B5&"'"&","&"'"&B6&"'"&","&"'"&B7&"'"&","&"'"&B8&"'"&","&"'"&B9&"'"

Formula Breakdown:

The ampersand sign (&) will join the single quotes (‘’) and the commas (,) with the cell values to create a comma separated list with single quotes.

Convert Column to Comma Separated List Manually

  • Press ENTER to see the result.

Convert Column to Comma Separated List Manually

Read More: How to Convert Columns to Rows in Excel (2 Methods)


Method 2 – Using the CONCATENATE Function to Convert a Column into a Comma Separated List

Use the CONCATENATE function.

Steps: 

  • Enter the formula in C5.
=CONCATENATE("'",B5,"',", "'",B6,"',", "'",B7,"',","'",B8,"',","'",B9,"'")

Formula Breakdown:

The CONCATENATE function will take strings and join them to make a large text.

Use the CONCATENATE Function to Convert Column to Comma Separated List

  • Press ENTER to see the result.

Use the CONCATENATE Function to Convert Column to Comma Separated List

Read More: How to Transpose Columns to Rows In Excel (6 Methods)


Similar Readings


Method 3 – Applying the TEXTJOIN Function to Convert a Column into a Comma Separated List

Use the TEXTJOIN function.

Steps: 

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

Formula Breakdown:

The TEXTJOIN function concatenates strings using a delimiter. Here, the delimiter is a comma (,).

Apply the TEXTJOIN Function to Convert Column to Comma Separated List

  • Press ENTER to see the result.

TEXTJOIN Function

Read More: How to Convert Columns to Rows in Excel Based On Cell Value


Method 4 – Convert a Column into a Comma Separated List Using a VBA Macro

Step 1: 

  • Select Visual Basic in the Developer tab. You can also press ALT+F11 to open it.

Convert Column to Comma Separated List Using VBA Macro

Step 2:

  • Click Insert and select Module.

Convert Column to Comma Separated List Using VBA Macro

  • Use the following code in the module. Press CTRL+S to save the code.
Function ColumntoList(ColRange As Range)
    Dim ListOutput
    Dim cell As Variant
    For Each cell In ColRange
        If Not IsEmpty(cell.Value) Then
            ListOutput = ListOutput & "'" & cell.Value & "',"
        End If
    Next
     ColumntoList = Left(ListOutput, Len(ListOutput) - 1)
End Function

ColumntoList VBA Function

Step 3:

  • Go back to the worksheet and enter the following code in C5.
=ColumntoList(B5:B9)

ColumntoList VBA Function

  • Press ENTER to see the result.

Convert Column to Comma Separated List Using VBA Macro

Read More: VBA to Transpose Multiple Columns into Rows in Excel (2 Methods)


Method 5 – Using the Find & Replace Tool to Convert a Column into a Comma Separated List

Use the Find & Replace tool.

Step 1: 

  • Select all the cells in the Product column except the column header.
  • Right-click any of the selected cells and click Copy. You can also press CTRL+C to copy the selected cells.

Use the Find & Replace Tool to Convert Column to Comma Separated List

Step 2: 

  • Paste the copied cells into a blank Word document by pressing CTRL+V.

Paste Options (Ctrl)

  • Click Paste Options (Ctrl) and select Keep Text Only.

Use the Find & Replace Tool to Convert Column to Comma Separated List

  • Press CTRL+H to open the Find and Replace tool.
  • Enter“^p” in Find what.
  • Enter “,” in Replace with.
  • Click Replace All.

 Find & Replace

 All cell values in the Product column are converted into a comma separated list.

Use the Find & Replace Tool to Convert Column to Comma Separated List

Read More: Convert Columns to Rows in Excel Using Power Query


Related Articles

Get FREE Advanced Excel Exercises with Solutions!
ASM Arman
ASM Arman

Abu Saleh Arman is a Marine engineer and Excel & VBA expert. He loves programming with VBA. He finds VBA programming a time-saving tool to manipulate data, handle files, and interact with the internet. He is very interested in Python, MATLAB, PHP, Deep Neural Networks, and Machine Learning, showcasing his diverse skill set. Arman holds a B.Sc in Naval Architecture & Marine Engineering from BUET, Bangladesh. However, he switched to a content developer, where he writes technical content... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo