Counting the number of matches including repeats

BrSuthe

New Member
Joined
Feb 10, 2018
Messages
29
I need a formula to count the number of matches between two ranges even some numbers repeat itself. For example, if in row1 ( 1,1,1,3,3,4,2,8) and row2(1,2,3,4,5,5,7,7). Here there are 4 unique numbers match (1,2,3,4). But with repeating numbers, it is actually 7 numbers (1,1,1,3,3,2,4). I need a formula to count the latter method. I'd be glad if someone can suggest me a formula for this. Thanks!​




 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
maybe:
Code:
=SUMPRODUCT((A1:H1=A2)+(A1:H1=B2)+(A1:H1=C2)+(A1:H1=D2)+(A1:H1=E2)+(A1:H1=F2)+(A1:H1=G2)+(A1:H1=H2))
 
Upvote 0
Thanks, everybody for your help. I tried them, but didn't get the result I wanted. I found a solution though. Here it is:
Code:
=sumproduct(--isnumber(match(a1:h1,a2:h2,)))
Thanks again!
 
Upvote 0
Cross posted
https://www.excelforum.com/excel-fo...-the-number-of-matches-including-repeats.html

From Forum Rules
Rule #13:
We prefer that members do not cross-post questions to other forums, but when this does occur members should do the following:
- Post the details of your question on our forum. Do NOT simply post a link/re-direct to the question in another forum with no details posted here.
- Make it clear that you have cross-posted and provide links to the cross-posts.
Cross-posted questions that do not comply may be deleted or locked. For a discussion on the issues with cross-posting, see this link: Excelguru Help Site - A message to forum cross posters


M.
 
Upvote 0
Thanks, everybody for your help. I tried them, but didn't get the result I wanted. I found a solution though. Here it is:
Code:
=sumproduct(--isnumber(match(a1:h1,a2:h2,)))
Thanks again!

hmm... not sure this formula does what you want

Question: what would be the expected result for a scenario like this

[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][td="bgcolor: #DCE6F1"]
F
[/td][td="bgcolor: #DCE6F1"]
G
[/td][td="bgcolor: #DCE6F1"]
H
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
1​
[/td][td]
1​
[/td][td]
1​
[/td][td]
3​
[/td][td]
3​
[/td][td]
4​
[/td][td]
2​
[/td][td]
8​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
1​
[/td][td]
1​
[/td][td]
2​
[/td][td]
3​
[/td][td]
4​
[/td][td]
5​
[/td][td]
5​
[/td][td]
7​
[/td][/tr]
[/table]


M.
 
Upvote 0
I am sorry about the cross-posting. I needed to get a quick reply so I did post twice.
and you are right about your example. In this case, it should be 6. but the formula gives 7. so it is not what i want. This means I still need a formula. It is strange though, I tested the formula first, and it worked. why it doesn't work in this scenario I don't understand.
 
Upvote 0
I correct my previous post. I made a mistake in counting. The formula gives 7, and it is correct. These numbers repeat. [TABLE="width: 175"]
<tbody>[TR]
[TD="class: xl63, width: 25"] 1
[/TD]
[TD="class: xl63, width: 25"] 1
[/TD]
[TD="class: xl63, width: 25"] 1
[/TD]
[TD="class: xl63, width: 25"] 3
[/TD]
[TD="class: xl63, width: 25"] 3
[/TD]
[TD="class: xl63, width: 25"] 4
[/TD]
[TD="class: xl63, width: 25"] 2
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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