ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sort according to most repeated entries (https://www.excelbanter.com/excel-discussion-misc-queries/248686-sort-according-most-repeated-entries.html)

Roadtripper902902V3V

Sort according to most repeated entries
 
Hello,
How can I sort a column based on repetition.

For example,

Anna
Bob
Bob
Bob
Bob
Chuck
Chuck
Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Sam
Sam
Sam



will be:

Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Bob
Bob
Bob
Bob
Sam
Sam
Sam
Chuck
Chuck
Anna

Dave Peterson

Sort according to most repeated entries
 
I would insert a new column.

Then fill it with a formula like:
=countif(a:a,a1)
(and drag down as far as I need.)

Then sort the range by this column (primary key, descending) and the original
column (as the secondary key).

Roadtripper902902V3V wrote:

Hello,
How can I sort a column based on repetition.

For example,

Anna
Bob
Bob
Bob
Bob
Chuck
Chuck
Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Sam
Sam
Sam

will be:

Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Tiger
Bob
Bob
Bob
Bob
Sam
Sam
Sam
Chuck
Chuck
Anna


--

Dave Peterson

Roadtripper902902V3V

Sort according to most repeated entries
 
Thanks, Dave. Your "countif" formula worked.
It didn't seem necessary to do the "secondary key" sorting. All I did after
the getting the "countif" formula from top to bottom was just "sort" this new
column of countif values by largest to smallest.
Am I missing something?

Thanks.

Dave Peterson

Sort according to most repeated entries
 
If there are entries that show up with the same count, you may find those
entries mixed up.



Roadtripper902902V3V wrote:

Thanks, Dave. Your "countif" formula worked.
It didn't seem necessary to do the "secondary key" sorting. All I did after
the getting the "countif" formula from top to bottom was just "sort" this new
column of countif values by largest to smallest.
Am I missing something?

Thanks.


--

Dave Peterson


All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com