Share via

Need to add a comma after the data in each cell??

Anonymous
2013-06-12T05:42:06+00:00

!! I need help!!

-Windows 7

-Excel 2007

Spread sheet contains a column with nearly 2K contacts, which need a comma in each cell (following the data).

Ex:

******@something.com

******@something.com

******@something.com

"    "

"    "

It needs to look like:

******@something.com,

******@something.com,

******@something.com,

"    "

"    "

I've been copying them and pasting them to in sections of 100 to a Word document and manually adding the comma- it's taking a lifetime. Someone please help me figure this out. I've also researched a bit online. Someone said to save the excel doc as csv. then reopen, copy and paste to a Word doc and supposedly a comma should be there. It's not working for me.

Thank you so much!!!!!

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

29 answers

Sort by: Most helpful
  1. Anonymous
    2013-06-12T06:14:57+00:00

    hi april_showers412,

    are those in different rows?  if so, use this formula in B1 assuming data in A1:

    =A1&","

    copy down.  saving as csv or text will not work for you because it separates columns by commas

    if you need to combine A1 with A2 & so on, then in B1:

    =A1

    in B2:

    =B1&","&A2

    copy down

    200+ people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-06-12T06:23:27+00:00

    Spread sheet contains a column with nearly 2K contacts, which need a comma in each cell

    Piece of cake

    1. In free column, type =C1& ","

    Assuming the data is starting in C1

    Then copy and paste the formula down for as many rows as required.

    1. VBA

    Public Sub AddCommas()

    Dim EndRow As Long, I As Integer, J As Long

    I = 3  '  Change 1  to whichever column you have your original data in.  If in column F, replace 1 with 6

    EndRow = Cells(Rows.Count, I).End(-4162).Row

    Application.ScreenUpdating = False

    For J = 1 To EndRow

    Cells(J, I + 1) = Cells(J, I) & ","   '  Assuming column I +1 is free.

    Next

    Application.ScreenUpdating = True

    End Sub

    50+ people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2013-06-12T06:22:13+00:00

    Give this a try...

    1. Selec the entire column.
    2. Press CTRL+H to bring up the Replace dialog box.
    3. Click into the "Find what" field and type CTRL+J (it will not look like anything happened, but you put a Line Feed character into the cell by doing that).
    4. Click into the "Replace with" field and type a comma followed by CTRL+J (the field will look like it only has a comma in it, but actually it has a comma followed by a Line Feed character in it).
    5. Click the "Replace All" button.
    6. Check the column of data to make sure the commas were inserted.
    20+ people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2013-06-12T07:06:17+00:00

    Give this a try...

     

    1. Selec the entire column.

     

    1. Press CTRL+H to bring up the Replace dialog box.

     

    1. Click into the "Find what" field and type CTRL+J (it will not look like anything happened, but you put a Line Feed character into the cell by doing that).

     

    1. Click into the "Replace with" field and type a comma followed by CTRL+J (the field will look like it only has a comma in it, but actually it has a comma followed by a Line Feed character in it).

     

    1. Click the "Replace All" button.

     

    1. Check the column of data to make sure the commas were inserted.

    Thank you for taking your time to respond to my post. I did as you said and this is the message that came up after selecting "Replace All" :

    !!! “Microsoft Office Excel cannot find any data to replace. Check if your search formatting and criteria are defined correctly. If you are sure that matching data exists in this workbook, it may be on a protected sheet. Excel cannot replace data on a protected worksheet.”

    I went to Options for Find Format &  Replace Format and selected "Protection". Neither "Locked" or "Hidden" are checked. Although it is not a protected sheet, I went ahead and opened a new Excel sheet and tried the application once again

    • receiving the same notice. :( 

    Thank you, again, for your time. I appreciate your help!

    10+ people found this answer helpful.
    0 comments No comments
  5. Anonymous
    2013-06-12T09:29:44+00:00

    Well, you two are extremely intelligent! I believe I lost you both at "VB..." I'm a fast learner but have no idea what we are talking about here. Sorry~ 

    Would either of you be able to dumb this down some, for me?

    First off, my manual solution did not work for you because I had assumed you had data on multiple lines within the same cell and wanted a comma at the end of each line except the last one. That is also what my VB code solution (as well as j.dsouza's) did, so forget that previously posted code. However, there is a VBA solution which I will give to you below along with instructions on how to implement it. First, the code...

    Sub AddCommas()

      Dim Addr As String

      Addr = "A1:A" & Cells(Rows.Count, "A").End(xlUp).Row

      Range(Addr) = Evaluate("IF(LEN(" & Addr & ")," & Addr & "&"","","""")")

    End Sub

    The above code assumes your data is in Column A and starts at Row 1 (see the bolded text above). If that is not the case, then change the values (the bolded text) to match your actual setup.

    HOW TO INSTALL MACROs


    If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (AddCommas) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for.

    8 people found this answer helpful.
    0 comments No comments