+ Reply to Thread
Results 1 to 10 of 10

Populate cell with values from multiple other cells based on criteria

  1. #1
    Registered User
    Join Date
    12-08-2010
    Location
    Kansas City, MO
    MS-Off Ver
    Excel 2003
    Posts
    5

    Populate cell with values from multiple other cells based on criteria

    I have a De-Dup'ing project that I am working on, and I feel like I am missing something really simple here.

    I have a worksheet that has 4 columns in it: ID, CUSTODIAN, DUPID, ALLCUSTODIANS

    ID is the unique index.
    CUSTODIAN is the name of the custodian for that record
    DUPID is an ID used for grouping
    ALLCUSTODIANS is my target rield

    What I am trying to do is run through the DUPID field and for all of the records that have the same DUPID, I want to populate the ALLCUSTODIANS field with the names of the CUSTODIANS separated by a ;

    I attached the excel spreadsheet I am working off of. I went ahead and manually populated the ALLCUSTODIANs field just to show what I want the results to be

    There are just a handful of records in the spreadsheet (normally I would have anywhere from 5000 - 50000 records with many CUSTODIANS and DUPIDs, some custodians and their DupIDs listed multiple times)

    I have played around with pulling the data into Access, and am just not gaining any ground.
    I am a VB Programmer, but frankly, I am not sure where to start with this project.
    I would prefer to end up with a Macro or VBScript, but am not picky at this point.

    Thanks in advance for any direction or guidance you can lend me.


    ID Custodian DupID AllCustodians
    13456 Smith, John 12456
    13480 Black, William 12456
    13524 Black, William 0
    13567 Night, Amy 15789
    13589 Night, Amy 15789
    13594 Night, Amy 0
    13609 Jones, Jim 15789
    13610 Jones, Jim 12456

    The ALLCUSTODIANS should end up like below:

    ALLCUSTODIANS
    Smith, John; Black, William; Jones, Jim
    Black, William; Smith, John; Jones, Jim
    Black, William
    Night, Amy; Jones, Jim
    Night, Amy; Jones, Jim
    Night, Amy
    Jones, Jim; Night, Amy
    Jones, Jim; Smith, John; Black, William
    Attached Files Attached Files
    Last edited by blakenm; 12-13-2010 at 04:31 PM. Reason: Adding attachment back

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

    Re: Populate cell with values from multiple other cells based on criteria

    Looking for that attachment... zip it up if you need to.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    12-08-2010
    Location
    Kansas City, MO
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Populate cell with values from multiple other cells based on criteria

    Ok, it looks like it wanted to be zipped!

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

    Re: Populate cell with values from multiple other cells based on criteria

    I added a new function to your workbook called CONCATIF(). It functions like a SUMIF() with two extra parameters. Have a look.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-08-2010
    Location
    Kansas City, MO
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Populate cell with values from multiple other cells based on criteria

    Awesome. Thanks for the quick response.
    I tried it against my actual spreadsheet and can't get it to work. There are 21000 records/rows, and I thought I adjusted it accordingly, but can't get it to work. I zipped this new spreadsheet with the 21000 records. Can you take a look and see if I am doing something off?
    Attached Files Attached Files

  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: Populate cell with values from multiple other cells based on criteria

    You didn't add the CONCATIF() User Defined Function into your main workbook.

    I added it in and tried it, it's impossible with 21k records, the workbook dragged to a standstill with that many array formulas all with 21k calculation going in them at the same time. Best stick with Leith's "on demand" option.

  7. #7
    Registered User
    Join Date
    12-08-2010
    Location
    Kansas City, MO
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Populate cell with values from multiple other cells based on criteria

    Oh, duh, I knew I had to be missing something simple as far as why I couldn't get it to work.
    Thanks!
    So what is, or where do I find Leith's On Demand option?
    Seeing what I am trying to do, do you have any other suggestions? Even if I have to take it outside of excel.
    Thanks again for your quick responses on this!

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

    Re: Populate cell with values from multiple other cells based on criteria

    Sorry about the OnDemand thing, I was mixing up your thread with an almost identical one elsewhere.

    Like so:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    12-08-2010
    Location
    Kansas City, MO
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Populate cell with values from multiple other cells based on criteria

    Oh thank you.
    That is perfect.
    I so appreciate your help with this!
    It is people like you that get people like me going again when we get stuck!
    Thanks again,
    Nicole

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

    Re: Populate cell with values from multiple other cells based on criteria

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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