Return Nth instance of text string

Partjob

Board Regular
Joined
Apr 17, 2008
Messages
139
I have the following formula that returns the most frequently occuring string in a range. what I would like to do is return the 2nd, 3rd 4th and 5th most common occourance as well. I am not sure if I can do this by adjusting this formula or whether that would be a completely diffent formula or worst case senario it is not possible at all.

=INDEX(B2:B1537,MATCH(MAX(COUNTIF(B2:B1537,B2:B1537)),COUNTIF(B2:B1537,B2:B1537),0))

obviously this is an array.

Partjob
 
Thank you all for your help.
For the record xld's solution worked for me.
andrew's didn't give me the required result for the reason stated in the thread.
Richard's returned N/A not really sure why?
It would be nice if it was all in one formula but what I have works so what more can I ask.
Thanks again
Partjob

Richard's fails if you have blanks in the range, mine was more generic.
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Good spot Bob. My formula could be amended to:

=INDEX($A$1:$A$15,MATCH(TRUE,COUNTIF($A$1:$A$15,$A$1:$A$15&"")=LARGE(FREQUENCY(MATCH($A$1:$A$15&"",$A$1:$A$15&"",0),MATCH($A$1:$A$15&"",$A$1:$A$15&"",0)),2),0))

to take account, but it counts blank cells as a valid return (so it will return 0 if blanks are the second most populous result in the above)
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,381
Members
449,155
Latest member
ravioli44

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