+ Reply to Thread
Results 1 to 7 of 7

Moving A Row Of Data Into One Cell

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Oakland
    MS-Off Ver
    Excel 2007
    Posts
    6

    Moving A Row Of Data Into One Cell

    Hey everyone at Excel Forum. I just started a new project at work and need a little bit of help.

    Essentially, there are two columns I am dealing with. One is "Sales Rep" and it lists all of the sales reps employed by the company. The other is "Zip Code" and that will list all of the zip codes that sales rep is responsible for.

    Now, I have a row of data, all of those zip codes listed out, that each rep is responsible for, but my supervisor wants all of the zip codes listed in one cell, in that second column. Example: (02018, 34098, 16711).

    The commas are not necessary, but is there any way to get this done other than manually entering them?

    Thanks in advance for any help.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Moving A Row Of Data Into One Cell

    If the zips are in columns B:F starting in row 2, In G2
    =B2 &", " &C2 &", " & D2&", " & E2 & &", " & F2

    If there are not always the same number of zip codes, best to skip the commas and do something like
    = TRIM(B2 &" " & C2 &" " & D2 &" " & E2 &" " & F2)
    You can copy and Paste Special > Values to remove the formulas
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    12-13-2012
    Location
    Oakland
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Moving A Row Of Data Into One Cell

    Hey Chemist,

    Yeah, that works, but that's pretty much like the Concatenate formula, where I'll need to copy every cell number and letter anyway. This will help in the long run as I can simply pull that formula down for the rest of the worksheet, but this is about 80 numbers, is there anyway to mass add them, or do I have to add each cell one by one into that formula?

  4. #4
    Registered User
    Join Date
    12-13-2012
    Location
    Oakland
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Moving A Row Of Data Into One Cell

    I just tried this and I think it works. Is there something I can do to still pull down this formula for other sales reps that don't have as many zip codes and not end up with a bunch of commas in the cell?

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Moving A Row Of Data Into One Cell

    You can use a UDF (User defined function) which uses VBA (Visual basic for Applications). Here's one by Tigeravatar.
    How to enter it
    1. Copy the code, In your workbook, hit ALT F11 (to open vba editor)
    2. Insert> Module in the editor
    3. Paste the code into the white text box.
    4. Close the editor
    How to use it
    1. Has the format = ConcatAll(range, delimiter) for example = ConcatAll(B2:F2, ", ")
    2. Macros need to be enabled for it to work. Sheet must be saved as an xls or an xlsm workbook
    Please Login or Register  to view this content.
    Questions?

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Moving A Row Of Data Into One Cell

    Re; Post #4
    You'll note in my second formula in Post #2, I didn't include the commas. The TRIM will remove the extra spaces. If you want the commas, after you paste special > values, you can select the column and CNTRL H replace space with ,space.

  7. #7
    Registered User
    Join Date
    12-13-2012
    Location
    Oakland
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Moving A Row Of Data Into One Cell

    Thank you so much, Chemist. This was a big help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1