Extracting unique values and counting them in large xls

nn992

New Member
Joined
Jul 28, 2016
Messages
47
Hello everyone,


I have an excel file like table below. I want him to extract me only the unique items from "Source" column and then to count them in "Ocurences" column.

I did it with with DATA--->Advanced--->copy unique entries etc.
and then countif...
but this xls has 8000+ rows, so it crashes when I try to do it in this way... Any macros or suggestions how to do it?




 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
A pivot table would be one really quick way to achieve this. Use the Source as the row values and then a count of them in the total.
 
Upvote 0
How about
Code:
Sub GetDupes_Qty()

    Dim Cl As Range

    With CreateObject("scripting.dictionary")
        For Each Cl In Range("G2", Range("G" & Rows.Count).End(xlUp))
            If Not .exists(Cl.Value) Then
                .Add Cl.Value, 1
            Else
                .Item(Cl.Value) = .Item(Cl.Value) + 1
            End If
        Next Cl
        Range("H2").Resize(.Count).Value = Application.Transpose(.keys)
        Range("I2").Resize(.Count).Value = Application.Transpose(.items)
    End With
        
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,409
Messages
6,124,733
Members
449,185
Latest member
hopkinsr

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