Finding Most Common String, then 2nd Most Common String, etc, in a Column

nj167252

New Member
Joined
May 10, 2016
Messages
4
Here is my problem,

I am trying to calculate the most common string, the 2nd most common string, up to the 10th most common. Here is some of the data:
FVHA
FVHA
FVFA
FVMV
FVBU
FVHA
FVHA
FVFA
FVBU
and many more. Here is an example of the formula for finding the most common:
{=IFERROR(INDEX(Feb!$H$3:$H$30,MODE(MATCH(Feb!$H$3:$H$30,Feb!$H$3:$H$30,0))), "")}
This formula works great, except I want it to ignore blank cells.
Here is an example of the formula for finding the 2nd most common:

{=IFERROR(INDEX(Feb!$H$3:$H$198,MODE(IF(COUNTIF(I$5:I6,Feb!$H$3:$H$198)=0,MATCH(Feb!$H$3:$H$198,Feb!$H$3:$H$198,0)))),"")}
Again this works great but I would like to ignore blank cells.

If anyone could help me modify these formulas so I can ignore any blank cells in the column, I would be so thankful.

Regards!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Maybe

Most common
=IFERROR(INDEX(Feb!$H$3:$H$30,MODE(IF(Feb!H3:H30<>"",MATCH(Feb!$H$3:$H$30,Feb!$H$3:$H$30,0)))), "")
Ctrl+Shift+Enter

M.
 
Upvote 0
text
FVHA
FVHA
FVFA
FVMV
FVBU
FVHACount of text
FVHAtextTotal
FVFAFVBU8a pivot table lists all unique strings
FVBUFVFA7
FVFAFVHA10
FVMVFVMV4
FVBUGrand Total29
FVHA
FVHA
FVFA
FVBUpulling out the numbers automaticallyusing large functionusing offset match
FVMV
FVBU1810FVHA
FVHA278FVBU
FVHA3107FVFA
FVFA444FVMV
FVBU5
FVFA6
FVMV7
FVBU8
FVHA9
FVHA10
FVFA11
FVBU12
13
14
15
16
tidy up as you want
all these helper tables can be hidden…

<colgroup><col span="4"><col><col><col span="13"></colgroup><tbody>
</tbody>
 
Upvote 0
if any blanks present pivot table will catalogue them and formula can ignore them (or just turn off blanks in pivot table
 
Upvote 0
To list the most common, 2nd most common etc in another sheet try


A
1
List​
2
FVHA​
3
FVFA​
4
FVBU​
5

Array formula in A2 copied down
=IFERROR(INDEX(Feb!$H$3:$H$30,MODE(IF(ISNA(MATCH(Feb!$H$3:$H$30,A$1:A1,0)),IF(Feb!$H$3:$H$30<>"",MATCH(Feb!$H$3:$H$30,Feb!$H$3:$H$30,0))))), "")
Ctrl+Shift+Enter

M.
 
Upvote 0

Forum statistics

Threads
1,215,014
Messages
6,122,697
Members
449,092
Latest member
snoom82

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