Most Frequent Letter in a Column of Single Letters?

skinnea

Board Regular
Joined
Mar 15, 2003
Messages
135
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet that uses C, Q and B to denote three different states for a number of locations (Closed, Quiet, Busy).

Looking down each column there will be multiple occurrences of each letter, but I want to find the most frequently occurring one.

I've been able to use the following formula to decide on the most frequent between two of the letters, but am unsure how to factor in a comparison against the third one?

=IF(COUNTIF(G3:G14,"c")>(COUNTIF(G3:G14,"b")),"c","b")

I want the calculating cell (where the formula above sits) to show the actual letter that is most frequent, not the number of times it appears.

MODE would give me the detail I wanted if I was using 1, 2 and 3 - but I'm not!!

Any ideas...? :confused:
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,

This works:

=IF(COUNTIF(G3:G14,"b")>MAX(COUNTIF(G3:G14,"c"),COUNTIF(G3:G14,"q")),"b",IF(COUNTIF(G3:G14,"c")>COUNTIF(G3:G14,"q"),"c","q"))

HTH

Alan
 
Upvote 0
A few weeks back, I'd have suggested one of the following which must be confirmed with constrol+shift+enter instead of just enter:

=INDEX(G3:G14,MATCH(MAX(COUNTIF(G3:G14,G3:G14)),COUNTIF(G3:G14,G3:G14),0))

or using the morefunc add-in:

=INDEX(G3:G14,MATCH(MAX(SETV(COUNTIF(G3:G14,G3:G14))),GETV(),0))

However, this is not quite right:
aaModeOfOrMostFrequentLetterVal skinnea.xls
GHIJK
11
2NameCountRank1Mode
3C51C
4C  B
5C   
6B52 
7Q23 
8B   
9B   
10B   
11C   
12Q   
13C   
14B   
Sheet1


Formulas...

H3:

=IF(G3<>"",IF(ISNUMBER(MATCH(G3,$G$2:G2,0)),"",COUNTIF($G$3:$G$14,G3)),"")

I3:

=IF(N(H3),RANK(H3,$H$3:$H$14)+COUNTIF($H$3:H3,H3)-1,"")

J1 houses 1 (meaning Top Frequent, set to 1)

J2, which computes the number of ties of the most frequent...

=MAX(IF(INDEX(H3:H14,MATCH(J1,I3:I14,0))=H3:H14,I3:I14))-J1

which must be confirmed with control+shift+enter instead of just enter.

K3:

=IF(ROW()-ROW($K$3)+1<=$J$1+$J$2,INDEX($G$3:$G$9,MATCH(ROW()-ROW($K$3)+1,$I$3:$I$9,0)),"")

As you see, C and B are the most frequent, not just C or B alone.
 
Upvote 0

Forum statistics

Threads
1,215,334
Messages
6,124,319
Members
449,153
Latest member
JazzSingerNL

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