Return of Duplicate sets with number of times their are Duplicated.

serge

Well-known Member
Joined
Oct 8, 2008
Messages
1,444
Office Version
  1. 2007
Platform
  1. Windows
Hi everyone,

I looking for a formula or UDF that will extract from D6:M100 all the Duplicate and how many time each set have been duplicated, ( very important ),Starting in cell : D102 Number of time duplicated and in cell E102 the set number, then below in cell D103 Number of time duplicated and in cell E103 the set number and so on.

Thank you very much, Serge.

See example portion below :
Excel Workbook
DEFG
602 06 11 16 3901 06 12 21 3901 02 09 19 3601 06 13 21 39
702 06 13 21 3901 03 12 16 3902 03 09 19 3601 12 21 36 39
801 02 09 21 3602 12 21 36 3902 03 11 19 3603 06 12 21 39
901 09 12 19 3603 06 12 21 3902 06 11 19 3601 06 12 19 39
1002 09 12 21 3602 06 13 21 3902 09 11 16 3602 09 11 16 39
1103 09 12 21 3602 06 09 21 3901 09 12 16 3902 11 16 36 39
1201 03 09 21 3601 03 09 21 3602 03 12 16 3902 09 11 21 36
1302 06 09 21 3601 09 12 21 3603 06 12 16 3902 03 09 21 36
1402 03 09 21 3602 03 09 16 3903 12 16 19 3902 09 13 21 36
1501 09 12 21 3603 09 12 16 3601 02 09 21 3602 03 09 19 36
1603 06 09 21 3602 06 09 21 3601 02 09 21 36
1702 06 09 21 36
1802 09 11 16 36
1902 09 19 21 36
20
21202 06 13 21 39
22301 02 09 21 36
234Etc
24
Sheet
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Not a formula or UDF, but I think does what you want.

Code:
Sub Count_Duplicate_Sets()
  Dim d As Object
  Dim a As Variant, itm As Variant
  
  Set d = CreateObject("Scripting.Dictionary")
  a = Range("D6:M100").Value
  For Each itm In a
    If Not IsEmpty(itm) Then d(itm) = d(itm) + 1
  Next itm
  With Range("D102").Resize(d.Count, 2)
    .Value = Application.Transpose(Array(d.Items, d.keys))
    .Columns(1).Replace What:=1, Replacement:="", LookAt:=xlWhole
    On Error Resume Next
    .SpecialCells(xlBlanks).EntireRow.Delete
    On Error GoTo 0
  End With
End Sub
 
Upvote 0
Thank you Peter for the code, I really appreciate your help, but can you explain how to put it in excel and what formula to use, sorry I'm really bad at it.
 
Upvote 0
1. With your workbook active press Alt+F11 to bring up the vba window.
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Press Alt+F8 to bring up the Macro dialog
6. Select the 'Count_Duplicate_Sets' macro & click ‘Run’
7. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm) if using Excel 2007 or later.
 
Upvote 0
Thank you very much Peter, it works perfect.
Serge.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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