How to Insert a Comma in Excel for Multiple Rows (3 Methods)

Dataset Overview

Suppose you have several rows containing data, and you want to insert a comma at the end of each row. You can achieve this using any of the following methods. These techniques work in all versions of Excel, including Microsoft 365.

Dataset to Insert Comma in Excel for Multiple Rows


Method 1 – Utilize Excel Ampersand (&) Operator

  • Click on the cell in column C (e.g., C5).
  • In the formula bar, enter the following formula:
=B5&","

Use Ampersand (&) to Insert Comma in Excel for Multiple Rows

  • Press Enter.
  • Now, the comma is added to the end of the content in cell B5, appearing in cell C5.
  • Drag the fill handle (located at the bottom right corner of the cell) downward to copy the formula for all cells below.

Drag Fill Handle Below to Copy Formula

  • As a result, all cells in the same column will have commas at the end of their data.

Inserted Commas in Excel for Multiple Rows


Method 2 – Use CONCATENATE Function

  • Click on the cell in column C (e.g., C5).
  • Enter the following formula in the C5 cell:
=CONCATENATE(B5,",")

Insert the CONCATENATE Function to Insert Comma in Excel for Multiple Rows

  • Press Enter.
  • The C5 cell now contains the data from B5 along with a comma at the end.
  • Drag the fill handle down to apply the formula to other cells.

Drag Fill Handle Below to Copy Same Formula

You will see that you have inserted commas in Excel for multiple rows successfully. The result will look like this:

Inserted Commas in Excel for Multiple Rows

Read More: How to Use Comma in Excel Formula


Method 3 – Apply a VBA Code to Insert Commas

  • Go to the Developer tab and select the Visual Basic tool.

Access the Visual Basic Tool

  • In the Microsoft Visual Basic for Applications window, choose the sheet where you want to apply the code (e.g., Sheet 7).
  • Enter the following VBA code:

Write the VBA Code in the Code window

Public Sub InsertComma()
Dim LastRow As Long, C As Integer, R As Long
C = 2  '  C represents the Excel column number with which you will add comma and R is the Row Excel row number from which you want to add comma.
LastRow = Cells(Rows.Count, C).End(-4162).Row
Application.ScreenUpdating = False
For R = 5 To LastRow
    Cells(R, C + 1) = Cells(R, C) & ","   '  Assuming column I +1 is free.
Next
Application.ScreenUpdating = True
End Sub
  • Save the file in macro-enabled format (e.g., .xlsm).

Code in the Code Window to Insert Comma in Excel for Multiple Rows

  • Close the code window and go to the File tab.

Go to File Tab

Choose the Save As option

  • Click on Save As.

Excel Save As Window

  • Choose the Excel Macro-Enabled Workbook option and save the file.

Save the Excel File as .xlsm File to Enable Macro

  • Return to the Developer tab, click Run, and select the created macro.

Access the Visual Basic Tool Again

  • Click Run to execute the code.

Run the VBA Code to Insert Comma in Excel for Multiple Rows

  • The Macros window will appear.
  • Choose the Created macro from the Macro Name List: Sheet7.InsertComma
  • Click on the Run button.

Choose the Macro to Insert Comma in Excel for Multiple Rows

  • After clicking the Run button in the Macros window, you’ll observe that the VBA code runs.
  • As a result, commas will be inserted in Excel for multiple rows based on the instructions provided in the VBA code.
  • The outcome should resemble the figure below:

Inserted Commas in Excel for Multiple Rows


Download Practice Workbook

You can download the practice workbook from here:


Related Articles


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

Get FREE Advanced Excel Exercises with Solutions!
Tanjim Reza
Tanjim Reza

Md. Tanjim Reza Tanim, a BUET graduate in Naval Architecture & Marine Engineering, contributed over one and a half years to the ExcelDemy project. As an Excel & VBA Content Developer, he authored 100+ articles and, as Team Leader, reviewed 150+ articles. Tanim, leading research, ensures top-notch content on MS Excel features, formulas, solutions, tips, and tricks. His expertise spans Microsoft Office Suites, Automating Finance Templates, VBA, Python, and Developing Excel Applications, showcasing a multifaceted commitment to the... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo