+ Reply to Thread
Results 1 to 7 of 7

Consolidating Text in Rows by Zipcode

  1. #1
    Registered User
    Join Date
    04-17-2009
    Location
    Santa Rosa, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Consolidating Text in Rows by Zipcode

    Hi I have a zipcode file I am trying to consolidated that has zipcodes and customers. Does anyone have a suggestion on how to consolidate the customers into a single row by zipcode as outlined below

    Current Data
    Zipcode Customer
    00001 Customer 1
    00001 Customer 2
    00001 Customer 3
    00002 Customer 4
    00002 Customer 5

    Desired output
    00001 Customer1, Customer2, Customer3
    00002 Customer4, Customer5
    etc etc

    I truly appreciate any advice on this issue I am struggling with since a pivot table doesnt seem to work on text.

    Thanks!!!!
    Last edited by Drew71; 04-19-2009 at 01:10 PM.

  2. #2
    Registered User
    Join Date
    01-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    67

    Re: Consolidating Text in Rows by Zipcode

    See if this attachment helps you...
    Attached Files Attached Files

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Consolidating Text in Rows by Zipcode

    The array formula suggested above will work, absolutely. But if your dataset gets big that may start to bog down. Also, your sample indicated you wanted the customers concatenated into a single cell.

    First, add this new function called ConcatIf() to your workbook.
    Please Login or Register  to view this content.
    1. Open up your workbook.
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet.
    Here's a sample book showing how it is used. It starts off exactly like a COUNTIF() formula.

    =ConcatIf($A$2:$A$30,E2,$B$2:$B$30,", ",TRUE)

    This is from the sample book attached which matches your sample data setup, in column F.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    04-17-2009
    Location
    Santa Rosa, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Consolidating Text in Rows by Zipcode

    Thanks!!

    This looks like the best thing for me since I have 60,000 rows to consolidate

    I followed your instructions, but got an error when trying to run the formula?

    Any ideas?

    Andrew
    Attached Images Attached Images

  5. #5
    Registered User
    Join Date
    04-17-2009
    Location
    Santa Rosa, CA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Consolidating Text in Rows by Zipcode

    HI!!

    I figured out where I went wrong. I didnt copy all of the text in your post.

    This works GREAT!!!

    Thanks so much for your help!!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Consolidating Text in Rows by Zipcode

    Awesome!

    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED]

  7. #7
    Forum Contributor daksh1981's Avatar
    Join Date
    04-15-2009
    Location
    India
    MS-Off Ver
    2003 & 2007
    Posts
    110

    Re: Consolidating Text in Rows by Zipcode

    Great code. Good logic put. Appreciated.

+ 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