Count the number of duplicates in a range and then create a ranked sort using VBA

  • Hi


    I have been scouring the web for info on this without success![Blocked Image: http://www.excelforum.com/images/smilies/frown.gif]


    I have a userform where users can input names of suppliers. As this list is built up, I want to have option buttons that have a caption name based on the most popular supplier name so that they can simply chose a supplier by clicking the appropriately named supplier. So, if after 10 entries, supplier "Smith" has been inserted 6 times and supplier "Jones" inputted 2 times and two other suppliers have been inputted once, I would like to have OptionButton1.Caption="Smith" and OptionButton2.Caption="Jones" created on the userform.


    This requires code for counting duplicates and ranking the result. I can't seem to get started on this!! Can anybody provide any guidance/help?


    Cheers[Blocked Image: http://www.excelforum.com/images/smilies/smile.gif]http://www.excelforum.com/exce…create-a-ranked-sort.html

  • Re: Count the number of duplicates in a range and then create a ranked sort using VBA


    Hi norwood,


    In excel 2007, there is readymade menu command:
    Select the data columns


    menu -> data-> remove duplicates


    This will remove the duplicates for you.


    If you have many columns . just select all columns , so the unique is compare all columns,


    If you select only one column, the unique is compare only one column.


    Why need to write codes for things available easily in excel.


    Hope you enjoy this.



    Regards
    S.Suresh

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!