Sum the total of duplicated items in a list

bearcub

Well-known Member
Joined
May 18, 2005
Messages
701
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
Is the a formula that will count the total number of unique items in a list

For example, if I have a list where 5 items appear more than once. One item might appear 3 times, another appear 2, etc.

I don't need to find if an item is duplicated I just need to sum the number of duplicate items (which would be 5). Is there a formula that will do that?

Thank you in advance,

Michael
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I think what I'm asking is not summing but counting the number of items that are duplicated, which would be 5.
 
Upvote 0
How about
=ROWS(A1:A7)-SUMPRODUCT((A1:A7<>"")/COUNTIF(A1:A7,A1:A7))
 
Upvote 0
Yes, this works great. This counts all the members in the list and then subtracts the duplicated items.

But, this there a formula with using the subtraction operation that will just count the members that are duplicated, not the number of duplicated items?

Thank you,

Just curious if there is another way of counting 1 for each member that is duplciated, not the the number times they're duplicated.

Michael
 
Upvote 0
If there is way of just counting 1 for each duplicated member, I don't know how.
 
Upvote 0
Perhaps
=SUMPRODUCT(IFERROR(1/(--(COUNTIF(A1:A20,A1:A20)>1)*COUNTIF(A1:A20,A1:A20)),0))

entered with Ctrl-Shift-Enter
 
Upvote 0
Control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(A1:A20,A1:A20)>0,1))

delivers the number of distinct/unique numbers which occur in A1:A20.

=SUM(IF(FREQUENCY(A1:A20,A1:A20)>1,1))

delivers the number of distinct/unique numbers which occur more than once in A1:A20.
 
Upvote 0
Thank you Mike for the formula. It works perfectly. I thought there would be 5 items but turns out there are 3 items that are have a total of 5 duplicates (in my particular list).

Michael
 
Upvote 0
Hi Aladin,

Thank you for the formulas. I modified the formulas to fit my criteria range but I'm getting zeros after entering CSE.

=SUM(IF(FREQUENCY(Groceries,Groceries)>0,1))
=SUM(IF(FREQUENCY(Groceries,Groceries)>1,1))

Groceries is named range from B4:B52. Is something missing from my list? Like maybe my range should be from B4:B53?

Michael
 
Upvote 0
Hi Aladin,

Thank you for the formulas. I modified the formulas to fit my criteria range but I'm getting zeros after entering CSE.

=SUM(IF(FREQUENCY(Groceries,Groceries)>0,1))
=SUM(IF(FREQUENCY(Groceries,Groceries)>1,1))

Groceries is named range from B4:B52. Is something missing from my list? Like maybe my range should be from B4:B53?

Michael

Grocesies should consist of numbers. Otherwise:

Control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF(Groceries<>"",MATCH(Groceries,Groceries,0)),ROW(Groceries)-ROW(INDEX(Groceries,1,1))+0)>0,1))

=SUM(IF(FREQUENCY(IF(Groceries<>"",MATCH(Groceries,Groceries,0)),ROW(Groceries)-ROW(INDEX(Groceries,1,1))+0)>1,1))

Note that these FREQUENCY formulas work faster than the other alternative formulations.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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