# Excel - matching values in columns in different tabs and then pasting into another column if there's a match

I have an Excel worksheet with two tabs, Tab 1 has a list of employees with information on different courses they've taken. Among them is a tab with a 5 digit employee ID to easily identify them..

On Tab 2 is a list of employees who took a course we'll call "Intro". This tab has an employee ID column as well as a "course date" column.

In the Tab 1, there's a column for course Intro where the date can be entered.

What I'm trying to do is have Tab 1 search the employees IDs on Tab 2 and if there is a match, grab the course date from that row and paste it into the column for Course Intro in Tab 1.

It seems like it should just be a VLOOKUP and then say "if you find this, then grab this cel and paste it over here"... but having a heck of a time!

-

## migrated from stackoverflow.comApr 10 '13 at 9:02

This question came from our site for professional and enthusiast programmers.

Sheet 1 data

``````1   name 1
2   name 2
3   name 3
4   name 4
5   name 5
6   name 6
``````

Sheet 2 data

``````name 3  today
name 4  Yesterday
name 5  a different day
name 6  tomorrow
name 7  never
``````

Query in cell C1 of sheet 1, copie and paste down

=VLOOKUP(B1,Sheet2!A:B,2,FALSE)

Results

``````1   name 1  #N/A
2   name 2  #N/A
3   name 3  today
4   name 4  Yesterday
5   name 5  a different day
6   name 6  tomorrow
``````
-
Wow! This pretty much does it! Thanks so much - I'm amazed at how simple the formula is. I've got to mess around with how to address fields where there's already a date in place, but I'm well on the way. Thank you so much! – Jason Mar 1 '13 at 16:52
Glad I could help. If you have problems make sure that the field you want to bring over is to the right of the field you are comparing to (i.e. if 'Today' is in columen one and 'name 3' is in column 2, vlookup will not work). – James Jenkins Mar 1 '13 at 17:02

Try something like this `=VLOOKUP(Tab2!ID,IDtable,2,False)` Where `IDtable` has the ID's in column 1 and course dates in column 2. Also change `Tab2!ID` to the relevant cell in Tab 2.

-