Counting duplicate values

frankiejr101

Board Regular
Joined
Mar 7, 2008
Messages
108
Not the usual. If A1:A7 is:
1
1
2
3
4
4
4

Then I'd like to have a formula that tells me how many duplicates it finds. So in this case B1 (where the formula would reside) would return a value of 2 since there were 2 sets of duplicates. Is this possible? Thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
This formula appears to work also...

=SUMPRODUCT((COUNTIF(A1:A7,A1:A7)>1)*(A1:A7<>A2:A8))

Note the range offset by one row for that last comparison... you will need to keep it in mind when you expand the formula to handle more rows than the 7 it was designed for.
 
Upvote 0
This formula appears to work also...

=SUMPRODUCT((COUNTIF(A1:A7,A1:A7)>1)*(A1:A7<>A2:A8))

Note the range offset by one row for that last comparison... you will need to keep it in mind when you expand the formula to handle more rows than the 7 it was designed for.

This did not work though the first countif did. I wonder if it has anything to do with the fact that my values are actually text and I just used numbers for ease in my example???
 
Upvote 0
Not the usual. If A1:A7 is:
1
1
2
3
4
4
4

Then I'd like to have a formula that tells me how many duplicates it finds. So in this case B1 (where the formula would reside) would return a value of 2 since there were 2 sets of duplicates. Is this possible? Thanks!

Control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF(A2:A8<>"",MATCH(A2:A8,A2:A8,0)),ROW(A2:A8)-ROW(A2)+1)>1,1))
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,847
Members
449,051
Latest member
excelquestion515

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