Looking up and matching data in different worksheets
Hi! I have two sheets in a workbook. In Sheet 1 I need to match the data in Column G plus the data in Column F to the data in Column C in Sheet 2. Any matches then need to return the data that is in Column A on Sheet 2 to Column J on Sheet 1.
Column F - First Name
Column G - Surname
Column J - (need to insert ID from Sheet 2)
Column A - ID number
Column C - Surname, First Name
So Column J in Sheet 1 needs to look up the data in Column G (Surname) and then Column F (First Name), then look for matches in Column C (Surname, First Name) of Sheet 2 and then return in Column J Sheet 1 the data in found in Column A Sheet 2 (ID Number) for those matches.
e.g. Sheet 1 Column F is 'Peter', Column G is 'Smith'; I want Excel to find 'Smith, Peter' in Sheet 2, Column C, and then look for his ID in Column A, Sheet 2. This ID number should then be returned to Column J in Sheet 1 (for said Peter Smith).
I hope that makes sense! I have no idea how to go about it though. Any help much appreciated!
On the worksheet with the IDs in it, you will need to swap the name and ID columns over. The formula below relies on the name being in column A and IDs in column B. You can do this by highlighting all of column A by clicking on the A at the top, then clicking and holding the black border, and whilst holding down the Shift button, drag it to the right of the IDs.
Next to the first set of names in the first worksheet, type in:
=VLOOKUP(G2 & ", " & F2,Sheet2!A:B,2,FALSE)
...where "Sheet2" is the name of the worksheet with IDs on it
Copy and paste this down for each set of names and where IDs exist you will get the ID returned, where the name combo can't be found, you'll get a "#N/A" error.
Give it a crack and let me know if it does what you're after.
|All times are GMT +1. The time now is 08:37 PM.|
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.