Most frequently occurring word/phrase across multiple columns

arvindsaraswat

New Member
Joined
Feb 12, 2013
Messages
13
I have an excel sheet where equally spaced columns starting from AD (AD, AI, AN, AS, AX, ...) contain a string.
The string can be anything from a set of 4 pre-defined strings.

Requirement - Find the string that occurs most frequently in these columns.


Example

AD -------- AI ---------- AN ---------- AS --------AX -------
----------------------------------------------------------------------------
xxx yyy yyy xxx xxx //output xxx
xxx xxx xxx xxx zzz //output xxx
yyy zzz zzz zzz xxx //output zzz
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You could use FREQUENCY but that's a CSE function. I'd just COUNTIFS for each predefined string for each column and add them up.
=COUNTIFS(AD,"xxx")+COUNTIFS(AI,"xxx")+COUNTIFS(AN,"xxx")+COUNTIFS(AS,"xxx")+ ... etc
=COUNTIFS(AD,"yyy")+COUNTIFS(AI,"yyy")+COUNTIFS(AN,"yyy")+COUNTIFS(AS,"yyy")+ ... etc
Say this is in cells BB1:BB4 you can then use =MATCH(MAX(BB1:BB4),BB1:BB4,0) to tell you which cell in BB1:BB4 had the max.
I would also use =COUNTIFS(BB1:BB4,MAX(BB1:BB4)) to tell you if several strings were used the most but were used equally.
 
Last edited:
Upvote 0
Searched the forum and found this... seems to work.

=INDEX(AD2:BC2,MODE(IF(MOD(COLUMN(AD2:BC2)-COLUMN(AD2),5)=0,IF(AD2:BC2<>"",MATCH(AD2:BC2,AD2:BC2,0)))))

This is array formula.
The number 5 is "uniform spacing between columns - 1".

This works in principle, but consider all columns in the range AD1:AX1. I am concerned with the content of equally spaced columns AD, AI, AN, AS, AX, ...
 
Upvote 0
=INDEX(CHOOSE({1,2,3},AD1,AG1,AX1),0,MODE(IFERROR(IF(AD1:AX1<>"",MATCH(CHOOSE({1,2,3},AD1,AG1,AX1),CHOOSE({1,2,3},AD1,AG1,AX1),0)),FALSE)))

Change the columns as needed
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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