Consulting

Results 1 to 4 of 4

Thread: Matching data from two different sheets

  1. #1
    VBAX Newbie
    Joined
    Apr 2016
    Posts
    1
    Location

    Matching data from two different sheets

    Hi all,


    Im trying to combine data from two separate data sets, one of which only has a subset of values from the other. Its a bit hard for me to explain so Ive attached an example. In sheet5 and sheet6 are the two data sets I have and in sheet7 is want I want to end up with. All the names with the same IDs in column B of sheet 6 should end up with the same ID from column B of sheet5.


    Sorry if this is difficult to understand. Im sure there is some simple way to do this but I cant figure it out.


    Thanks in advance for any help you can provide.
    Attached Files Attached Files

  2. #2
    VBAX Regular
    Joined
    Dec 2014
    Posts
    31
    Location
    It may be possible to do this using the PivotTable and PivotChart Wizard.

    http://www.contextures.com/xlPivot08.html

    http://answers.microsoft.com/en-us/o...b-0e87aff8148e

  3. #3
    VBAX Expert
    Joined
    May 2016
    Posts
    604
    Location
    I think you can get along way to where you want to go by using VlooKup,

    As a start try these two vlookups on sheet 7.
    in column E put;

    =VLOOKUP(A1,Sheet6!A$1:B$7,2,FALSE)

    copy this down,
    In column F
    put:
    =VLOOKUP(Sheet6!A1,Sheet5!A$1:B$3,2,FALSE)
    copy that down.

    The names that do appear on sheet 5 will have values the others won't

    You could then filter this list to just obtain the valid values and then do a final vlookup of the K value to get the C value.

    I am not quite sure what your requirements are, so I don't know if this is sufficient

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    In sheet6 (or a copy of it), in cell D1 enter:
    =VLOOKUP(A1,Sheet5!$A$1:$B$3,2,FALSE)
    and copy down. This is a helper column.

    in sheet6 (or a copy of it) in cell C1 array-enter (that is Ctrl+Shift+Enter, NOT just Enter) this formula:
    =INDEX($D$1:$D$7,MATCH(B1,IF(ISNA($D$1:$D$7),FALSE,$B$1:$B$7),0))
    and copy down.

    That's it.
    To get rid of formulae and the helper column, copy/paste-special:values column C in situ, then delete column D.
    Last edited by p45cal; 06-15-2016 at 11:44 AM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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