Concatewhat?
July 7, 2009 8:50 AM
Subscribe
I need to merge two Excel sheets with some common fields, but the most advanced formula I've ever used is Autosum.
I have two worksheets. One has a list of people that I've invited to an event. The other has a much larger list of people, including the people on the 1st sheet, which has a field for phone numbers. I'd like to bring the phone numbers from the 2nd sheet into the 1st sheet, but only for the people who are on the 1st sheet. Both sheets have "First Name" and "Last Name."
I've been googling around and have found things about vlookup and concatenating (same thing?). I've never used vlookup before, so I guess I'd need a basic primer in vlookup and/or how to use it in this specific instance to achieve what I want. Unless there's a better solution. I've also read about maybe pulling the two sheets into Access, but I'd rather not have too complicated an end-product since very tech-unsavvy people will need to be using the results.
On both sheets, Last and First name are columns A and B, and phone numbers on the second sheet are columns D, E, and F.
posted by thebazilist to computers & internet (9 comments total)
2 users marked this as a favorite
To my knowledge, vlookup only works on a single field, so you would need to first compress 'first and last name' into a single 'name' field.
Assuming our final worksheet will be:
Column A - First Name
Column B - Last Name
Column C - Full Name
Column D - Phone #
In column C, row 2, you would use the formula " =A2&' '&B2". This will return the contents of Column A followed by a space, followed by the last name. Copy this cell to all rows in column C. Copy all of column C, right-click and choose 'paste special'. Choose to paste the 'value'. This will overwrite the function with the actual combined name.
Now, repeat these same exact steps in your larger worksheet so you have a single column that should match back to the first worksheet. Make sure this 'full name' column comes BEFORE your phone number column.
Now, in column D of your first worksheet, you'll want to use VLOOKUP. I may not explain this well, so taking a look at the help for this function may be of assistance. Since you're working with two sheets, it's easier to start the function and then physically choose the cells you want to work with, rather than typing in the entire function.
In cell D2, type "=VLOOKUP(". This will tell excel you're starting the function. Use the arrow keys or mouse to then select cell C2 (full name). This tells the function what you want to find a match for. Once that's selected, type in a comma, then switch to your other worksheet and select the entire full name column AND any other columns UP TO the phone number column. Press comma again, then enter the position of the phone number column. (numbering starts with 1, and that would be your full name field.) Finally, press comma again and type in 'false'.
A properly formatted function may look similar to the following:
=VLOOKUP(C2,WorkSheetName!D:E,2,false)
That would match on cell C2 of the current worksheet, then look at the sheet named "WorkSheetName", columns D and E. In my fake example here I would have the full name in column D, phone number in E. VLOOKUP, as far as I know, always looks for a match in the first column identified. The '2' indicates what data you want returned, in this case, the second column, or whatever is in column "E" for the matched record. False is what I've always used, I believe it has to do with duplicate records.
Another example:
=VLOOKUP(C2,WorkSheetName!A:E,5,false) - same as above, but full name is in column A, phone number is in column E, so we want this function to return the data from column E, or the fifth column that was selected.
Hope that helps.. if all else fails, look up some more documentation either in Office's Help or just a quick google and you should be able to figure out VLOOKUP.
posted by MarkLark at 10:01 AM on July 7 [1 favorite]