+ Reply to Thread
Results 1 to 7 of 7

Copy Data When a Matching ID # is Found

  1. #1
    Registered User
    Join Date
    05-02-2013
    Location
    Ventura California
    MS-Off Ver
    Excel 2007
    Posts
    7

    Copy Data When a Matching ID # is Found

    How do I match ID numbers and then copy corresponding data from one spreadsheet to another, when there may be one or multiple instances of the same ID number, and an ID number may be present in one spreadsheet but not the other? This is because the reports I am receiving from two different sources are based on transactions for the same population of users. Perhaps I need to separate the transaction specific data from the static data associated with each ID number (person). Not sure what the best practice is for prepping the data.

    Seems that a VLookup or pivot table may be the right tool but I haven’t been able to figure it out.

    I have attached a sample of what the data looks like.

    If you can provide any assistance it would be much appreciated.

    Paul
    Attached Files Attached Files
    Last edited by PaulStamper; 05-13-2013 at 11:51 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Copy Data When a Matching ID # is Found

    PaulStamper,

    What is your expected output?
    Hope that helps,
    ~tigeravatar

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

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Copy Data When a Matching ID # is Found

    If there are "multiple instances of the same ID number", then they aren't very useful as ID numbers, especially if you need to match them.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Copy Data When a Matching ID # is Found

    If you want values from table 1 returned to table 2, vlookup will work just fine...
    =VLOOKUP($E5,$A$5:$C$12,2,FALSE)
    this is searching for the value in E5, in the range A5:C12, then returning the value in the 2nd column...the false is making sure its an exact match.
    Repeat for the next column, changing the ,2, to ,3, for the 3rd column.

    to prevent #NA error messages from showing - this happens when the item isnt there, you can wrap the formula in =iferror()...
    =IFERROR(VLOOKUP($E5,$A$5:$C$12,2,FALSE),"Not Found")
    change "Not Found" to whatever you want

    mltiple ID numbers will throw this off though, so you need to do something with them?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    05-02-2013
    Location
    Ventura California
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Copy Data When a Matching ID # is Found

    Thank you all for the quick response.
    I edited the post to explain that the reason for multiple ID's is they are transaction based and in some cases the same person had multiple transactions.

    The output I am hoping for is essentially to merge all of the data columns from one spreadsheet to the other based on ID number match.

    FDibbins- I just tested your VLOOKUP formula with the sample data and it is working great. I am going to apply it to the whole data set and see what I get.

    Thank you!

    Paul

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Copy Data When a Matching ID # is Found

    Dont forget that if your ID's are not all unique, the vlookup will only return the very 1st match it finds. If they are not unique, you will need to find some way to make them unique - maybe by combining thee transaction number with the ID?

  7. #7
    Registered User
    Join Date
    05-02-2013
    Location
    Ventura California
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Copy Data When a Matching ID # is Found

    Sorry for the delay in responding. The formula is working. I just had to work through a few VLOOKUP requirements that I was not aware of. My full data set did not have the ID's in the first column and they were not sorted or formatted the same so the match was not working until I solved these three things.

    Thanks for your outstanding help!

    Paul

+ 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