简体   繁体   中英

Excel - matching records between worksheets based on more than one column

I have two worksheets basic format of them both is:

  • C1,lastname,firstname,c4,c5,c6

I am trying to make a column on the second worksheet (which is significantly smaller then the other one) that tells me if a record worksheet 2 matches a record in worksheet 1, based on the first and last name.

This filter almost got me what I wanted:

=IF(ISERROR(MATCH(B2:C2,Table2[last name]:Table2[First Name],0)),"user gone","user exists")

Except it would return true if user's first name matched another's first name in worksheet 1 and user's last name matched someone else's last name. Example:

  • worksheet two has jane doe, looking for jane doe in worksheet one
  • worksheet one has jane jill and john doe, but no jane doe. code comes up true
  • if worksheet one only had one of those users, then i get false

I need the filter to return true only if jane doe exists in both lists. How can i tweak my filter to do this? i keep finding ways to match single columns in records not multi columns between records.

You can do this pretty easily with an array formula.

Be sure to enter as an array formula using ctrl+shift+enter :

=IF(SUM((B2=Table2[last name])*(C2=Table2[First Name])*1),"user exists","user gone")

The sum searches for the name and returns a one or a zero, and the if statement assigns it a value.

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