Solved

VBSCRIPT to match and merge data form 2 spreadsheets

Posted on 2010-11-09
4
423 Views
Last Modified: 2012-05-10
i ahve 2 speradsheets with informaiton and one identical field called "EmployeeID". need to use that field to get data from second spreaheet or second tab and populate the matching columns from sheet to sheet 1. or a formaula in excel will fdo as well.

attaching a sample file

sheet 1 is target that needs to be completed from sheet 2. this is just a sample, i have over 20K records to caompre and match. sheet 2 will have more records than sheet 1 but i only need to match up on EmployeeID to get data from sheet 2.
sample.xlsx
0
Comment
Question by:aroina
  • 2
4 Comments
 
LVL 80

Expert Comment

by:byundt
ID: 34098240
Try the following formula in target cell C2:
=VLOOKUP($B2,source!$B:$Z,MATCH(target!C$1,source!$B$1:$Z$1,0),FALSE)

Note that the formula returns #N/A if either the column header label or the employee ID is not found. The former problem was caused in part by an extra space at the end of "manager " in Source cell E1.
0
 
LVL 80

Expert Comment

by:byundt
ID: 34098256
The suggested formula assumed that the real lookup table occupies columns B through Z on worksheet source. The reference to $B$1:$Z$1 should be to the header labels in that lookup table. And since the formula is going on the target worksheet, I could have simplified it to:
=VLOOKUP($B2,source!$B:$Z,MATCH(C$1,source!$B$1:$Z$1,0),FALSE)
0
 

Accepted Solution

by:
keden earned 125 total points
ID: 34098765
You could incorporate error capturing to remove the #N/A's to pretty it up a bit.  Same as above...place the formula below in target sheet cell 2 and carry all the way down.  This particular example brings back the managers name where there is a match and leaves blank if no match is found.

=IF(ISERROR(VLOOKUP(B:B,source!B:E,4,FALSE))=TRUE,"",VLOOKUP(B:B,source!B:E,4,FALSE))

Rod
0
 

Author Comment

by:aroina
ID: 34102439
Rod... your solution works perfect for the manager field... can you do the same for the userid?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now