2nd most common entry if

Fazila

Board Regular
Joined
Nov 19, 2014
Messages
163
Hi

Any ideas how I can get the second most commonly occurring text value based on an if. The data I have is as follows:

ABC
ClassTeacherSubject
10x/Ar1AOWArt
11x/Ar1AOWArt
11z/Ar1AOWArt
7L10/ArAOWArt
7L3/ArEBEArt
7L8/ArEBEArt
10y/Ci1RAMCitizenship
11x/Ci1RAMCitizenship
10w/Ci1SAHCitizenship

<tbody>
</tbody>

I have named the ranges so column A is Cls, Column B is Teach and Column C is Sub. The formula needs to go into another sheet?

To get the most common entry I have used the formula: {=INDEX(Sheet6!$B$2:$B$431,MODE(IF(Sheet6!$C$2:$C$431=Sheet4!$A3,MATCH(Sheet6!$B$2:$B$431,Sheet6!$B$2:$B$431,0))))}

I now need the second most common then the third etc.

I need to know the most occurring value based on subject so for Art my first common value would be AOW then EBE and for Citizenship the most common value would be RAM then SAH.

Any help would be really appreciated.

Thanks
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Upvote 0
Maybe...


A
B
C
D
E
F
1
Class​
Teacher​
Subject​
Art​
Citizenship​
2
10x/Ar1​
AOW​
Art​
AOW​
RAM​
3
11x/Ar1​
AOW​
Art​
EBE​
SAH​
4
11z/Ar1​
AOW​
Art​
5
7L10/Ar​
AOW​
Art​
6
7L3/Ar​
EBE​
Art​
7
7L8/Ar​
EBE​
Art​
8
10y/Ci1​
RAM​
Citizenship​
9
11x/Ci1​
RAM​
Citizenship​
10
10w/Ci1​
SAH​
Citizenship​
11

Array formula in E2 copied across and down
=IFERROR(INDEX($B$2:$B$10,MODE(IF($C$2:$C$10=E$1,IF(ISNA(MATCH($B$2:$B$10,E$1:E1,0)),MATCH($B$2:$B$10,$B$2:$B$10,0)+{0,0})))),"")
Ctrl+Shift+Enter

Hope this helps

M.
 
Upvote 0
Thanks Marcelo and sorry to be so awkward but is there a way for the formula to work if the table is as below:

ABCDEFGHIJ
SubjectClass 1HwATLDTLClass 2HwATLDTLClass 3
Art{=INDEX(Teach,MODE(IF(Sub=Sheet4!$A3,MATCH(Teach,Teach,0))))}Second teacher with second most classesThird teacher with third most classes
Citizenship{=INDEX(Teach,MODE(IF(Sub=Sheet4!$A4,MATCH(Teach,Teach,0))))}As aboveAs above

<tbody>
</tbody>

Thanks I really appreciate the help with this.
 
Upvote 0
This layout complicates things a lot!
I suggest that you first create the list, as I suggested above, in an empty area of the worksheet.
Then you can create formulas that referred to this list to bring the results to the appropriate cells in the other worksheet.

M.
 
Upvote 0
This layout complicates things a lot!
I suggest that you first create the list, as I suggested above, in an empty area of the worksheet.
Then you can create formulas that referred to this list to bring the results to the appropriate cells in the other worksheet.

M.

That seems to be the best bet thanks Marcelo.
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,226
Members
448,878
Latest member
Da9l87

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