Closed Thread
Results 1 to 3 of 3

VBA help need to merge data from 2 worksheets into one

  1. #1
    Registered User
    Join Date
    02-12-2014
    Location
    Washington,USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    VBA help need to merge data from 2 worksheets into one

    I have data in two work sheets and need to merge the worksheets into one based on the employee id. any help with VBA is much appreciated.

    work sheet1:
    Name Emp id DOB Address City State
    John 1234 8/1/1970 123 main st detroit MI
    Eric 5678 11/12/1976 456 cass av chicago IL
    Tim 9876 12/1/1975 722 wayne cr New York NY

    worksheet2:
    Empid Current title Department Office
    1234 Sales Manager Dept1 Office1
    5678 Marketing Exec Dept2 Office2
    9876 Analyst Dept3 Office3

    Expected result:

    Name Empid DOB Address City State
    John 1234 8/1/1970 123 main st detroit MI
    Current title Sales Manager
    Department Dept1
    Office Office1
    Eric 5678 11/12/1976 456 cass av chicago IL
    Current title Marketing Exec
    Department Dept2
    Office Office2
    Tim 9876 12/1/1975 722 wayne circle New York NY
    Current title Analyst
    Department Dept3
    Office Office3

  2. #2
    Registered User
    Join Date
    01-25-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2013/2010/2007/2003, Mac Excel 2011
    Posts
    8

    Re: VBA help need to merge data from 2 worksheets into one

    You can simply use VLOOKUP...
    In Sheet1, assume your"Emp id" in column B. And Sheet2, data in Column A to D...

    In columns H in sheet 1:
    =VLOOKUP($B2,Sheet2!$A:$D,2,FALSE)
    This will lookup the Current title.

    For Dept and office, you use:
    =VLOOKUP($B2,Sheet2!$A:$D,3,FALSE)
    =VLOOKUP($B2,Sheet2!$A:$D,4,FALSE)

    Regards,
    Edwin Tam
    Excel Power Expander - http://www.vonixx.com

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

    Re: VBA help need to merge data from 2 worksheets into one

    Thread posted in Commercial Services, hence closed.
    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]

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel 2007 : How do I merge data from 2 different worksheets
    By Cshadwick07 in forum Excel General
    Replies: 8
    Last Post: 06-15-2012, 01:23 PM
  2. How to merge data from 2 worksheets
    By 4joey1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2010, 09:49 AM
  3. [SOLVED] Is it possible to merge data from two worksheets?
    By Valerian in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-12-2006, 01:25 PM
  4. merge two worksheets with different columns and data
    By Moon in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-23-2005, 03:06 PM
  5. [SOLVED] Merge data from 2 Excel worksheets
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2005, 04:06 PM

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