The function you want to use is VLOOKUP. How you do this will depend slightly on how your sheets are arranged, but all will follow the same syntax:
=VLOOKUP(lookup value, table array, column index number, range lookup)
lookup value is the data you want to search for.
table array defines the cells you want to pull data from, including the column containing your search target
column index number is the index of the column within table array from which you want to pull information. (e.g.: For an array of A:E, column D would be 4.)
range lookup is a TRUE/FALSE option to specify whether an approximate match is acceptable, or an exact match is needed. To keep things simple, I always set this to FALSE. Press F1 in Excel if you need more details.
The format of your formula will differ just a bit depending on whether your data is all in the same workbook or not. I'll give examples for each below.
IMPORTANT NOTE: The search term you're using as a lookup value must be findable in the first column of table array for VLOOKUP to work.
First Example: All data is going to be in the same Excel Workbook, but on different sheets. The first sheet is labeled "Usernames" and contains just the usernames. The second sheet is called "User Data" and contains all the user details. We'll call the third sheet "Lookup Results". The "User Data" sheet contains five columns, A:E.
- Make sure the "User Data" spreadsheet has all the usernames in column A.
- Copy all the usernames from "Usernames" to "Lookup Results".
- I'm going to presume you're using a header row, so the first username on "Lookup Results" will land in A2.
- Formula for B2 on "Lookup Result" should be:
=VLOOKUP(A2,'User Data'!A:B,2,FALSE)
- Formula for B3 on "Lookup Result" should be:
=VLOOKUP(A3,'User Data'!A:B,2,FALSE)
- Formula for C2 on "Lookup Result" should be:
=VLOOKUP(A2,'User Data'!A:C,3,FALSE)
You should see the pattern here by now. For each column, you should be able to just write the VLOOKUP formula in the first cell (e.g.: B2), then populate the formula down the rest of the sheet. However, cut-and-paste of the formula across columns is not so straightforward - you need to update the table array and column index number values.
Second Example: Each data set is kept in its own Excel Workbook. The sheet names within the workbook are default (i.e.: The first sheet is "Sheet1"). The workbook file names are "Usernames.xlsx", "User Data.xlsx", and "Lookup Results.xlsx". These are all in a folder called "My Spreadsheets", which is on the Desktop of a user called "Me".
- Make sure the "User Data.xlsx" sheet has all usernames in column A.
- Copy all usernames from "Usernames.xlsx" to "Lookup Results.xlsx".
- Again, presuming you use a header row, this will start in A2.
- Formula for B2 in "Lookup Result.xlsx" should be
=VLOOKUP(A2,'C:\Users\Me\Desktop\My Spreadsheets\[User Data.xlsx]Sheet1'!A:B,2,FALSE)
- Formula for B3 in "Lookup Result.xlsx" should be
=VLOOKUP(A3,'C:\Users\Me\Desktop\My Spreadsheets\[User Data.xlsx]Sheet1'!A:B,2,FALSE)
- Formula for C2 in "Lookup Result.xlsx" should be
=VLOOKUP(A2,'C:\Users\Me\Desktop\My Spreadsheets\[User Data.xlsx]Sheet1'!A:C,3,FALSE)
Again, you should be able to see the pattern here by now. Cut/paste/tweak as needed down the rows and across the columns, and you're set.
One other thing to keep in mind here is that this sheet will not be automatically updated for changes in the "Usernames" data. Changes to the "User Data" sheet can be pulled with this method, but more advanced techniques will be needed if you want to follow changes in "Usernames" as well.