Find the 1st/2nd/3rd Common Text w/ Criteria

_eNVy_

Board Regular
Joined
Feb 9, 2018
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Looking for a formula that will give me the result of the most common text within my dataset.

I currently have, for the first common text result the following formula :
Excel Formula:
{=INDEX(tblMain[Placement Provider],MODE(IF(tblMain[Reporting Fin-Year]=RIGHT(E4,5),IF(tblMain[Placement Provider]<>"",MATCH(tblMain[Placement Provider],tblMain[Placement Provider],0)))))}

tblMain[Placement Provider] holds all the text where I wish to find the recurring texts.
tblMain[Reporting Fin-Year] is the financial year of the and the basis of my first criteria range
RIGHT(E4,5) extracts the financial year in the format that is presented in tblMain[Reporting Fin-Year]

However, I am finding it extremely difficult to get the 2nd and 3rd (potentially 4th and 5th) most common texts. Especially with the blanks in tblMainPlacement Provider] and the criteria of the financial year.

Any and all help will be appreciated.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I have done as per my example. You can modify it as per your requirement

Book1
ABCDEFGHI
3YearTextMost Five Frequently Occuring TextNumber of times Occuring
4Year202001-02-2020aa4
501-02-2020bs3
6v2
703-02-2020fdc2
804-02-2020sf2
905-02-2020ag2
1006-02-2020dh3
1107-02-2020A
1208-02-2020x
1309-02-2020v
1410-02-2020v
15
1601-03-2020c
1702-03-2020s
18
1904-03-2020c
2005-03-2020f
2106-03-2020r
2207-03-2020e
2308-03-2020s
24
2510-03-2020g
2611-03-2020h
2712-03-2020h
2813-03-2020a
29
3015-03-2020f
3116-03-2020g
3217-03-2020h
3318-03-2020hj
3419-03-2021a
35
3621-03-2021f
3722-03-2021r
3823-03-2021e
3924-03-2021r
4025-03-2021w
4126-03-2021w
4227-03-2021w
Sheet2
Cell Formulas
RangeFormula
H4:H10H4=INDEX($E$4:$E$42,AGGREGATE(15,6,IF(MATCH(FREQUENCY(IFERROR(MATCH(IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),0),FALSE),ROW(D4:D42)-ROW(D4)+1),LARGE(FREQUENCY(IFERROR(MATCH(IF($D$4:$D$42/(YEAR($D$4:$D$42)=$B$4),$E$4:$E$42),IF($D$4:$D$42/(YEAR($D$4:$D$42)=$B$4),$E$4:$E$42),0),FALSE),ROW($D$4:$D$42)-ROW($D$4)+1),{1;2;3;4;5}),0),IFERROR(MATCH(IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),0),FALSE)),{1;2;3;4;5;6;7}))
I4:I10I4=SUM(--(IF(YEAR($D$4:$D$42)=$B$4,$E$4:$E$42)=H4))
Dynamic array formulas.
 
Upvote 0
Solution
I have done as per my example. You can modify it as per your requirement

Book1
ABCDEFGHI
3YearTextMost Five Frequently Occuring TextNumber of times Occuring
4Year202001-02-2020aa4
501-02-2020bs3
6v2
703-02-2020fdc2
804-02-2020sf2
905-02-2020ag2
1006-02-2020dh3
1107-02-2020A
1208-02-2020x
1309-02-2020v
1410-02-2020v
15
1601-03-2020c
1702-03-2020s
18
1904-03-2020c
2005-03-2020f
2106-03-2020r
2207-03-2020e
2308-03-2020s
24
2510-03-2020g
2611-03-2020h
2712-03-2020h
2813-03-2020a
29
3015-03-2020f
3116-03-2020g
3217-03-2020h
3318-03-2020hj
3419-03-2021a
35
3621-03-2021f
3722-03-2021r
3823-03-2021e
3924-03-2021r
4025-03-2021w
4126-03-2021w
4227-03-2021w
Sheet2
Cell Formulas
RangeFormula
H4:H10H4=INDEX($E$4:$E$42,AGGREGATE(15,6,IF(MATCH(FREQUENCY(IFERROR(MATCH(IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),0),FALSE),ROW(D4:D42)-ROW(D4)+1),LARGE(FREQUENCY(IFERROR(MATCH(IF($D$4:$D$42/(YEAR($D$4:$D$42)=$B$4),$E$4:$E$42),IF($D$4:$D$42/(YEAR($D$4:$D$42)=$B$4),$E$4:$E$42),0),FALSE),ROW($D$4:$D$42)-ROW($D$4)+1),{1;2;3;4;5}),0),IFERROR(MATCH(IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),IF(D4:D42/(YEAR(D4:D42)=B4),E4:E42),0),FALSE)),{1;2;3;4;5;6;7}))
I4:I10I4=SUM(--(IF(YEAR($D$4:$D$42)=$B$4,$E$4:$E$42)=H4))
Dynamic array formulas.

Thanks a lot! I sampled your formula and it worked on a small range. I need to just alter it to look at the Years as Financial Years (2019/20, 2020/21).

When I tried to expand the range however, I get the 'ran out of resources' error message!!!! Urgh!
Will have to contact my tech team to do something about this.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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