How do I identify repeating row sets?

javifais

New Member
Joined
Dec 14, 2015
Messages
28
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a two column sheet. Column A has user ids, about 1000. Column 2 has different access privileges associated with each id. I need to identify the users who have identical access. Is there a way to spit out grouping of users ids that have identical access? Thank you in advance.
 

Attachments

  • findIdentical.PNG
    findIdentical.PNG
    27.2 KB · Views: 21

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
In your example I found the following:

1689871822665.png


If the above is a typo, then try the following macro:

VBA Code:
Sub identify_repeating()
  Dim dicA As Object, dicB As Object
  Dim a As Variant, b As Variant, ky As Variant, itm As Variant, its As Variant
  Dim i As Long, j As Long, k As Long
  
  Set dicA = CreateObject("Scripting.Dictionary")
  Set dicB = CreateObject("Scripting.Dictionary")
  a = Range("A2", Range("B" & Rows.Count).End(3)).Value
  
  For i = 1 To UBound(a, 1)
    dicA(a(i, 1)) = dicA(a(i, 1)) & a(i, 2) & "|"
  Next
  
  For Each ky In dicA.Keys
    dicB(dicA(ky)) = dicB(dicA(ky)) & ky & "|"
  Next
    
  ReDim b(1 To dicA.Count, 1 To dicB.Count)
  For Each itm In dicB.Items
    its = Split(itm, "|")
    If UBound(its) > 1 Then
      k = 1
      j = j + 1
      For i = 0 To UBound(its) - 1
        b(k, j) = its(i)
        k = k + 1
      Next
    End If
  Next
  
  Range("D2").Resize(UBound(b, 1), UBound(b, 2)).Value = b
End Sub
 
Upvote 1
Solution
Your code worked perfectly. Thank you!
Apologies for the delayed response. Life happened.
 
Upvote 0

Forum statistics

Threads
1,223,914
Messages
6,175,351
Members
452,638
Latest member
Oluwabukunmi

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