VBA Count Duplicates from a varied range on one sheet using another sheets list

decadence

Well-known Member
Joined
Oct 9, 2015
Messages
525
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
Is it possible to count number of instances of duplicate and unique cells found from a varied range using a list of data from another sheet as a reference to on what to look for? My data will be varied with up to 20,000 rows and up to 10 columns Also the cells will contain both numbers and letters, I will have 2 sheets one with the duplicate data and another with Total Duplicates. Can someone help with this please? Thanks

Example:

From this (Duplicates sheet)

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Header 1
[/TD]
[TD]Header 2
[/TD]
[TD]Header 3
[/TD]
[TD]Header 4
[/TD]
[TD]Header 5
[/TD]
[/TR]
[TR]
[TD]Apple
[/TD]
[TD]Banana
[/TD]
[TD]Orange
[/TD]
[TD]Pear
[/TD]
[TD]Grapes
[/TD]
[/TR]
[TR]
[TD]Orange
[/TD]
[TD]Apple
[/TD]
[TD]Pear
[/TD]
[TD]Apple
[/TD]
[TD]Orange
[/TD]
[/TR]
[TR]
[TD]Orange
[/TD]
[TD]Pear
[/TD]
[TD]Apple
[/TD]
[TD]Orange
[/TD]
[TD]Pear
[/TD]
[/TR]
[TR]
[TD]Pear
[/TD]
[TD]Orange
[/TD]
[TD]Pear
[/TD]
[TD]Pear
[/TD]
[TD]Apple
[/TD]
[/TR]
</tbody>[/TABLE]

To This (Total Duplicates Sheet)

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Duplicates
[/TD]
[TD]Count
[/TD]
[/TR]
[TR]
[TD]Apple
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]Banana
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]Orange
[/TD]
[TD]6
[/TD]
[/TR]
[TR]
[TD]Pear
[/TD]
[TD]7
[/TD]
[/TR]
[TR]
[TD]Grapes
[/TD]
[TD]1
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
How about
=COUNTIF(Sheet1!$A$2:$E$5,A2)
 
Upvote 0
Hi Fluff, thanks for the reply however this formula is for the example, my data is varied so I can't specify exact range
 
Upvote 0
In that case how about
=COUNTIF(Sheet1!A:L,A2)
Change the L to the last column you are likely to get
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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