简体   繁体   中英

Adding cells from one sheet to another based on common cell

I've tried a few other answers here which seemed similar, but I haven't had any luck yet.

I have two sheets. The first sheet has two columns: A column with user IDs and a column with user names. There are several rows that have the same names and user IDs (I can't delete these duplicates).

I have another sheet that has a column with the user IDs and a column with their email addresses.

I need to populate the first sheet with the email addresses that corresponds to the user ID.

In other words, I need to match the same user IDs from both pages and add the email address to the first page.

I hope this makes sense-I tried to create a little table here to better demonstrate it, but the formatting isn't working for me. I'm not familiar with macros, and I'm hoping to do this in a function. I tried this one from another answer here and it didn't work for me:

=IF($A1=Sheet1!$A1, VLOOKUP(Sheet1!$A1, Sheet1!$A1:$D1, 2),"")

Maybe like this?

=VLOOKUP(A1,Sheet2!A:B,2,0)

Just put the formula in Sheet1 cell C1 and copy it down.

I expect that your user IDs are in Sheet1 Column A and Sheet2 Column A. In Sheet2 Column B there should be emails.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM