MODE-1

DArinello

Board Regular
Joined
Jul 26, 2005
Messages
63
I need to figure something out on my sheet. The “mode” function tells you witch value repeats the most. I want to see if there is another value that repeats just as much. Also, I want to see what value repeats the second most.

Ex:
4
6
4
7
5
6
4
5
5

If I use the function: =mode(list). It will return, “4”. By using =countif((list),mode(list)) I see that that repeated 3 times.

I want a way to see that “5” also repeated 3 times and then that 6 is repeated 2 times.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi

How about using the countif function on a list of unique number?


Tony
 
Upvote 0
aaDistinctTop2MostFrequent DArinello.xls
ABCDE
1N Distinct Largest2
2Calculated Top N3
3Ties Nth1
4NumFreqRankTop NFreq
543143
662353
74  62
871582
9532  
106    
114    
125    
135    
14824
158    
16
Data


Formulas...

B5, copied down:

=IF(ISNA(MATCH(A5,$A$4:A4,0)),COUNTIF($A$5:$A$15,A5),"")

C5, copied down:

=IF(N(B5),RANK(B5,$B$5:$B$15)+COUNTIF(B5:$B$5,B5)-1,"")

D1: 2

which is a user entered value, indicating the desired number of most frequent distict numbers.

D2:

=COUNTIF(B5:B13,">="&LARGE(B5:B13,COUNTIF(B5:B13,LARGE(B5:B13,1))+(D1-1)))

D3:

=MAX(IF(INDEX(B5:B15,MATCH(D2,C5:C15,0))=B5:B15,C5:C15))-D2

which must be confirmed with control+shift+enter, not just with enter.

D5, copied down:

=IF(E5<>"",INDEX($A$5:$A$15,MATCH(ROW()-ROW($D$5)+1,$C$5:$C$15,0)),"")

E5, copied down:

=IF(ROW()-ROW($E$5)+1<=$D$2+$D$3,INDEX($B$5:$B$15,MATCH(ROW()-ROW($E$5)+1,$C$5:$C$15,0)),"")
 
Upvote 0

Forum statistics

Threads
1,215,172
Messages
6,123,438
Members
449,100
Latest member
sktz

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