Count duplicate values in a range

cortexnotion

Board Regular
Joined
Jan 22, 2020
Messages
150
Office Version
  1. 2013
Platform
  1. Windows
Hi All,

I have a range A2:A75. I need a formula for the following:

For cells than are greater than 0, I need to count any value that appears more than once in the range. I need to count the 1st appearance of the value in addition to the duplicates.

Many thanks for your help
 

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.
Does this formula do what you want (place it in cell B2 and copy down)...

=IF(OR(A2<0,COUNTIF(A$2:A$75,A2)=1),"",COUNTIF(A$2:A$75,A2))
 
Upvote 0
Hi Rick, thank you for your quick reply.

I was hoping to avoid using a helper column, if there is a single formula if possible? Thanks!
 
Upvote 0
I am unclear how you want that presented. How will the formula know what number to count? Can you describe what you want the complete output to be?
 
Upvote 0
If you only need a count, highlight the range and then click on the "Remove Duplicates" button in the ribbon. Once the process finishes, it will have a little pop up window that will tell you how many unique values and how many unique vales are there. After you have your count, just click undo to put everything back to the way it was.
 
Upvote 0
Can't remember if this works with 2013, or only 365
Excel Formula:
=COUNT(IF(COUNTIFS(A2:A75,A2:A75,A2:A75,">0")>1,A2:A75))
Needs to be confirmed with Ctrl Shift Enter, rather than just Enter.
 
Upvote 0
@Fluff,

If it is meant to all instances of numbers that appear two or more times (is that what the OP was asking for?), then it works in XL2010.
 
Upvote 0
I think that's what the OP is after (but could easily be wrong).
And thanks for confirming it works in older versions of Excel.
 
Upvote 0
This normally-entered formula also seems to work (it returns the same answer as your formula)...

=SUMPRODUCT(0+(COUNTIF(A2:A75,A2:A75)>1),0+(A2:A75>0))
 
Upvote 0
Hello Seniors, what're your comments on this?

=SUMPRODUCT(--(COUNTIF(A2:A75,A2:A75)>=2)*((A2:A75)>0))
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,753
Members
449,094
Latest member
dsharae57

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