Compare two columns in two different sheets and return the number of matches

tommyk203

New Member
Joined
Nov 24, 2015
Messages
13
I have three sheets,
  • Matchsheet1 - first data set
  • matchsheet2 - second data set
  • matchsheet3 - results should go here

Matchsheet1 and matchshhet2 contain lists of last names, first names, date of birth.

I need match sheet 3 to compare columns A and C in matchscheet1 to columns A and C in matchsheet2, and return the number of matches of lastname and date of birth rows. The answer should be 2. as smith with a birthdate of 1/2/1950 and doe with a birthdate of 1/4/1950 are in both sheets. it doesnt matter thant in one sheet a first name is tom and the other is thomas. I only want to compare last name and date of birth

1, MatchSheet1
2, MatchSheet2
3, MatchSheet3
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
From the examples you have provided this should work:

Excel Formula:
=SUMPRODUCT((Sheet1!A2:A4=Sheet2!A2:A4)*(Sheet1!C2:C4=Sheet2!C2:C4))
 
Upvote 0
From the examples you have provided this should work:

Excel Formula:
=SUMPRODUCT((Sheet1!A2:A4=Sheet2!A2:A4)*(Sheet1!C2:C4=Sheet2!C2:C4))
Thanks, but that doesnt work because the data is in different workbooks as I specified. I have an answer.

Excel Formula:
=sum(ArrayFormula(countif(  query(importrange(H7,"Sheet1!A2:A") & importrange(H7,"Sheet1!C2:C"),"where Col1 is not null",0),  query(importrange(H8,"Sheet1!A2:A")  & importrange(H8,"Sheet1!C2:C"),"where Col1 is not null",0))))
 
Upvote 0
Solution
Thanks, but that doesnt work because the data is in different workbooks as I specified. I have an answer.
Glad you worked out a solution but you do not specify you would like the answer to accommodate different workbooks.

If you had then I would have provided an answer to match.
 
Upvote 0
In the interest of other people learning here is a working solution for different workbooks:

Excel Formula:
=SUMPRODUCT(([Book1.xlsx]Sheet1!$A$2:$A$5=[Book2.xlsx]Sheet1!$A$2:$A$5)*([Book1.xlsx]Sheet1!$C$2:$C$5=[Book2.xlsx]Sheet1!$C$2:$C$5))
 
Upvote 0

Forum statistics

Threads
1,215,356
Messages
6,124,471
Members
449,163
Latest member
kshealy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top