I have one Excel spreadsheet which has the following columns:
Surname / First Name / e-mail / gender / info 1 / info 2 / info 3 / info 4
This is a master spreasheet with everyone’s details.
I have another spreadsheet containing just the e-mail addresses of a handful of people. All of them are in the master spreadsheet.
The columns are as follows: Surname / First Name / e-mail / Project / gender / info 2 / info 3 / info 4 / info 1
Is there a way of asking Excel to look in the e-mail column of the master spreadsheet and search for the e-mail mentioned in the other spreadsheet. When the matching e-mail is found, look up data in master spreadsheet for that person, and transpose them into appropriate columns in the other spreadsheet.
I’m happy to clarify anything that doesn’t make much sense.
Cheers!
EDIT: changed title from “Importing data from another Excel spreadsheet based on specific values” to “Looking up Excel data when the key column (one with reference values) is not leftmost”
In your case, you want to perform a lookup on a data table where the key column is not the leftmost column – which means you cannot use Excel’s prime contender for such a lookup, the
VLOOKUPformula. The following ways will work:If the emails in the master spreadsheet are sorted in ascending order
Use Excel’s
LOOKUPfunction. Assuming that in both your spreadsheets the “Surname” is column A and that you have named all columns in the correct order in your question, the lookup for Surname in row 1 would be:with the other columns adjusted accordingly. The second parameter never changes ; the third takes whatever column index the values you want to lookup has in the master table (i.e. B for First Name, D for gender etc.).
Note this assumes your master spreadsheet as 100 rows of data to look up (adjust accordingly –
LOOKUPdoes not work with entire columns, and you cannot useVLOOKUP, which does).… and if they are not
Use a combination of
INDEXandMATCHfunctions. Assuming the same layout as above, the lookup for Surname in row 1 would be:Note this fails if the address is not matched exactly – be wary of capitalization differences, trailing and leading whitespace, and differing cell data formats.
Note for both variants
“Master.xls” and “TableName” are just placeholders for the sake of demonstration – they need to be replaced by the correct file and table names. The easiest way to create inter-file references is to open both files and fill the formula per point and click – Excel will create the correct references for you. However, be warned that linking to another file inside a formula relies on that file not changing its path, ever.