+ Reply to Thread
Results 1 to 5 of 5

Merging Columns from 2 sheets based on a common column

  1. #1
    Registered User
    Join Date
    02-21-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    9

    Merging Columns from 2 sheets based on a common column

    Hello All,

    I need some help to design a macro which can help me to merge columns from 2 sheets.I have Sheet1 with 4 columns including column Header "ID".I have around 19 coulmns in Sheet2 including column "ID" which is common on both sheets.I would like to get all the records in Sheets 1 along with matching data for the 18 columns from Sheet2 onto a seperate sheet Sheet3.
    I have included the sample data in Sheet1 and Sheet2 and have provided the desired data set in Sheet3.
    Can some one help me to transform the data to Sheet3.

    Thanks in Advance.
    Attached Files Attached Files
    Last edited by skilaru; 02-24-2012 at 04:26 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Merging Columns from 2 sheets based on a common column

    All you need to use is vlookup. May not be just 1 but several.

    First copy all your IDs (remove duplicates) into Sheet3. And then get the data from Sheet1 & Sheet2 into Sheet3 using vlookup.
    For e.g. to get the Name from Sheet1, use this formula in B2 of sheet3 =VLOOKUP(A2,Sheet1!A:D,2,0).
    To get the Currency1 from sheet2, use this formula in G2 of sheet3 =VLOOKUP(A2,Sheet2!A:S,4,0)

    Let me know if you need more help with this.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    02-21-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Merging Columns from 2 sheets based on a common column

    Hi Arlu1201,

    Thanks for your response.But Can I have a macro which can do the above function and this can help me with a single click instead of doing VLOOKUP 18 times on Sheet2. And I have to do this exercise quite frequently and macro code would save lot of my efforts.

    Please suggest.

    Thank You.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Merging Columns from 2 sheets based on a common column

    You can use this code -
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Merging Columns from 2 sheets based on a common column

    Hi,

    This thread appears to be a duplicate of

    http://www.excelforum.com/excel-prog...iple-rows.html

    If it's not sorry, but, if it's the same question then close out the one you do not need.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

+ 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