Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
KarenH
 
Posts: n/a
Default Top 10 Text Values

I have a column of text values in which I need to display the ten most
frequently occurring. I tried setting the AutoFilter and choosing "Top 10",
but it doesn't seem to be doing anything. I checked into some functions that
I thought might work, like Frequency and Rank, but those seem to be for
numbers only. Is there a way I can accomplish this? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default Top 10 Text Values

Assuming that A2:A100 contains your text values, try the following which
will take into consideration ties for 10th place...

B2, copied down:

=IF((A2<"")*(ISNA(MATCH(A2,$A$1:A1,0))),COUNTIF($ A$2:$A$100,A2),"")

C2, copied down:

=IF(N(B2),RANK(B2,$B$2:$B$100)+COUNTIF($B$2:B2,B2)-1,"")

D1: 10

This indicates that you want a Top 10 list. You can change this as
necessary. For example, if you want a Top 5 list, enter 5 instead.

E1:

=MAX(IF(B2:B100=INDEX(B2:B100,MATCH(D1,C2:C100,0)) ,C2:C100))-D1

....confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

F2, copied down:

=IF(ROW()-ROW($F$2)+1<=$D$1+$E$1,INDEX($A$2:$A$100,MATCH(ROW ()-ROW($F$2)+
1,$C$2:$C$100,0)),"")

Hope this helps!

In article ,
KarenH wrote:

I have a column of text values in which I need to display the ten most
frequently occurring. I tried setting the AutoFilter and choosing "Top 10",
but it doesn't seem to be doing anything. I checked into some functions that
I thought might work, like Frequency and Rank, but those seem to be for
numbers only. Is there a way I can accomplish this? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
KarenH
 
Posts: n/a
Default Top 10 Text Values

Excellent, that works great! Thanks!

"Domenic" wrote:

Assuming that A2:A100 contains your text values, try the following which
will take into consideration ties for 10th place...

B2, copied down:

=IF((A2<"")*(ISNA(MATCH(A2,$A$1:A1,0))),COUNTIF($ A$2:$A$100,A2),"")

C2, copied down:

=IF(N(B2),RANK(B2,$B$2:$B$100)+COUNTIF($B$2:B2,B2)-1,"")

D1: 10

This indicates that you want a Top 10 list. You can change this as
necessary. For example, if you want a Top 5 list, enter 5 instead.

E1:

=MAX(IF(B2:B100=INDEX(B2:B100,MATCH(D1,C2:C100,0)) ,C2:C100))-D1

....confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

F2, copied down:

=IF(ROW()-ROW($F$2)+1<=$D$1+$E$1,INDEX($A$2:$A$100,MATCH(ROW ()-ROW($F$2)+
1,$C$2:$C$100,0)),"")

Hope this helps!

In article ,
KarenH wrote:

I have a column of text values in which I need to display the ten most
frequently occurring. I tried setting the AutoFilter and choosing "Top 10",
but it doesn't seem to be doing anything. I checked into some functions that
I thought might work, like Frequency and Rank, but those seem to be for
numbers only. Is there a way I can accomplish this? Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
KarenH
 
Posts: n/a
Default Top 10 Text Values

What does the CONTROL+SHIFT+ENTER do that ENTER doesnt? I notice it puts
little curly brackets around the formula -- and that if I just enter, the
values don't come out right -- but I'm wondering what exactly that
combination does. Thanks again!


"Domenic" wrote:

=MAX(IF(B2:B100=INDEX(B2:B100,MATCH(D1,C2:C100,0)) ,C2:C100))-D1

....confirmed with CONTROL+SHIFT+ENTER, not just ENTER.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default Top 10 Text Values

CONTROL+SHIFT+ENTER is used when dealing with array formulas. For a
detailed explanation, have a look in Excel's help menu under 'Array
Formula'.

In article ,
KarenH wrote:

What does the CONTROL+SHIFT+ENTER do that ENTER doesnt? I notice it puts
little curly brackets around the formula -- and that if I just enter, the
values don't come out right -- but I'm wondering what exactly that
combination does. Thanks again!



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Top 10 Text Values

Domenic wrote...
Assuming that A2:A100 contains your text values, try the following which
will take into consideration ties for 10th place...

B2, copied down:

=IF((A2<"")*(ISNA(MATCH(A2,$A$1:A1,0))),COUNTIF( $A$2:$A$100,A2),"")

C2, copied down:

=IF(N(B2),RANK(B2,$B$2:$B$100)+COUNTIF($B$2:B2,B2 )-1,"")

D1: 10

This indicates that you want a Top 10 list. You can change this as
necessary. For example, if you want a Top 5 list, enter 5 instead.

E1:
=MAX(IF(B2:B100=INDEX(B2:B100,MATCH(D1,C2:C100,0) ),C2:C100))-D1

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

F2, copied down:
=IF(ROW()-ROW($F$2)+1<=$D$1+$E$1,INDEX($A$2:$A$100,
MATCH(ROW()-ROW($F$2)+1,$C$2:$C$100,0)),"")

....

Ancillary cells aren't necessary.

B2 [array formula]:
=INDEX($A$2:$A$100,MODE(MATCH($A$2:$A$100,$A$2:$A$ 100,0)))

B3 [array formula]:
=INDEX($A$2:$A$100,MODE(IF(COUNTIF(B$2:B2,$A$2:$A$ 100)=0,
MATCH($A$2:$A$100,$A$2:$A$100,0))))

Fill B3 down into B4:B11.

Ancillary cells can make this more efficient, but only additional one
column suffices.

B2:
=COUNTIF(A2:A100,A2)+1

B3:
=IF(COUNTIF(A$2:A2,A3)=0,COUNTIF(A3:A$100,A3)
+ROWS(B3:B$100)/ROWS($A$2:$A$100))

Fill B3 down into B4:B100.

C2:
=INDEX($A$2:$A$100,MATCH(MAX($B$2:$B$100),$B$2:$B$ 100,0))

C3 [array formula]:
=INDEX($A$2:$A$100,MATCH(MAX(IF($B$2:$B$100<VLOOKU P(C2,$A$2:$B$100,2,0),
$B$2:$B$100)),$B$2:$B$100,0))

Fill C3 down into C4:C11.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default Top 10 Text Values

A couple of issues...

1) It doesn't take into consideration ties for 10th place.

2) Owing to the MODE function, #N/A is returned when values occurring
more than once have been exhausted and only values occurring once remain.

Nevertheless, very interesting Harlan!

In article . com,
"Harlan Grove" wrote:

Ancillary cells aren't necessary.

B2 [array formula]:
=INDEX($A$2:$A$100,MODE(MATCH($A$2:$A$100,$A$2:$A$ 100,0)))

B3 [array formula]:
=INDEX($A$2:$A$100,MODE(IF(COUNTIF(B$2:B2,$A$2:$A$ 100)=0,
MATCH($A$2:$A$100,$A$2:$A$100,0))))

Fill B3 down into B4:B11.

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Top 10 Text Values

Domenic wrote...
A couple of issues...

1) It doesn't take into consideration ties for 10th place.


Meaning all tied values should be shown?

2) Owing to the MODE function, #N/A is returned when values occurring
more than once have been exhausted and only values occurring once remain.

....

B1 [array formula]:
=INDEX($A$1:$A$500,MATCH(MAX(COUNTIF($A$1:$A$500,$ A$1:$A$500)),
COUNTIF($A$1:$A$500,$A$1:$A$500),0))

B2 [array formula]:
=INDEX($A$1:$A$500,MATCH(MAX(IF(COUNTIF(B$1:B1,$A$ 1:$A$500)=0,
COUNTIF($A$1:$A$500,$A$1:$A$500))),COUNTIF($A$1:$A $500,
IF(COUNTIF(B$1:B1,$A$1:$A$500)=0,$A$1:$A$500)),0))

without including ties. If ties are an issue, then it's much better to
use two columns of formulas to produce the needed results.

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default Top 10 Text Values

In article .com,
"Harlan Grove" wrote:

Domenic wrote...
A couple of issues...

1) It doesn't take into consideration ties for 10th place.


Meaning all tied values should be shown?


Yes. I believe that any solution for a Top N list must show any and all
values tied for Nth place. Otherwise, which of the tied values should
be returned?

Personally, for a Top N list, I prefer the solution I offered. It takes
into consideration ties for Nth place, it doesn't use array formulas,
and is very efficient.

By the way, the solution I offered is courtesy of Aladin Akyurek.
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Peo Sjoblom
 
Posts: n/a
Default Top 10 Text Values

Here's a pretty easy way of doing it, assume the values are in A1:A100 with
a header in A1, sel;ect A1:A100, do datafileradvanced filter, select copy
to another location and where you want the filtered range, select unique
records only and click OK. This will give you a distinct list with the text
values, assume you put them in H1, in the first adjacent cell (in my example
I2) put

=COUNTIF($A$2:$A$100,H2)

copy down as long as needed, now select both columns (H and I) and sort
descending by column I, the first 10 values in H will be the top 10


--

Regards,

Peo Sjoblom






--

Regards,

Peo Sjoblom


"KarenH" wrote in message
...
I have a column of text values in which I need to display the ten most
frequently occurring. I tried setting the AutoFilter and choosing "Top

10",
but it doesn't seem to be doing anything. I checked into some functions

that
I thought might work, like Frequency and Rank, but those seem to be for
numbers only. Is there a way I can accomplish this? Thanks.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting two cell values into a new cell + text mmednick Excel Discussion (Misc queries) 6 December 6th 05 08:15 PM
How do I LOOKUP text values Amber C-W Excel Worksheet Functions 4 July 20th 05 05:27 PM
Help adding text values Texas-DC_271 Excel Worksheet Functions 7 January 15th 05 11:14 PM
how do i detect like text and add corresponding values? Lucy Excel Discussion (Misc queries) 2 December 17th 04 04:59 PM
text and values combined in one cel Bart Excel Discussion (Misc queries) 1 December 14th 04 08:36 AM


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"