Forum Discussion
Compare two workbook and return the cell value
Hi,
I've two sheets with the following structure:
- Sheet1 (Main) has columns A (Last Name), B (First Name), and C (Email);
- Sheet2 has columns A (Last Name), B (First Name), and C (Email).
I used the formula =IFERROR(IF(MATCH(A1, lookup_array, 0), "Yes"), "No") to find mismatching values between these two sheets.
Now, I'd like to improve it to return me the cell values in the column C (Email) from Sheet2 to Sheet1 in column D (Good Email) if there is a match on columns A or B.
In D2 on Sheet1:
=XLOOKUP(A2&" "&B2, 'Sheet2'!$A$2:$A$1000&" "&'Sheet2'!$B$2:$B$1000, 'Sheet2'!$C$2:$C$1000, "")
Replace Sheet2 to the real name of that sheet, then fill down.
3 Replies
Do you really want to match on column A or B? Or on columns A and B?
- Dan1ExcelUserCopper Contributor
I want to do both if possible. Because there are some cases where A and B are matching.
In D2 on Sheet1:
=XLOOKUP(A2&" "&B2, 'Sheet2'!$A$2:$A$1000&" "&'Sheet2'!$B$2:$B$1000, 'Sheet2'!$C$2:$C$1000, "")
Replace Sheet2 to the real name of that sheet, then fill down.