4th most common text value

sparkd

New Member
Joined
Jul 23, 2018
Messages
12
I currently have the following formula to capture the 3rd most common text value from a range.
I cant seem to change this in order to capture the 4th most common text value


=INDEX(S19:S52,MODE(IF(((S19:S52<>"")*(S19:S52<>INDEX(S19:S52,MODE(IF(S19:S52<>"",MATCH(S19:S52,S19,S52,0)))))*(S19:S52<>INDEX(S19:S52,MODE(IF((S19:S52<>"")*(S19:S52<>INDEX(S19:S52,MODE(IF(S19:S52<>"",MATCH(S19:S52,S19:S52,0))))),MATCH(S19:S52,S19:S52,0)))))),MATCH(S19:S52,S19:S52,0))))
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
First, you have a typo in your formula. In the first MATCH, you have S19,S52 when it should be S19:S52. Next, changing it to capture the 4th most common would be somewhat painful. Using the same logic, you'd have to add another set of INDEX/MODE/MATCH/MATCH functions. I'd suggest something like the formula in T19 where you just drag it down to get the most common values in order.


Book1
QRST
18Most common values
19dac
20aa
21ad
22be
23bf
24cb
25cx
26cz
27cy
28d
29e
30e
31c
32d
33a
34e
35d
36c
37x
38y
39x
40z
41a
42
43f
44f
45f
46
47z
48
49
50
51
52
Sheet2
Cell Formulas
RangeFormula
Q19{=INDEX(S19:S52,MODE(IF(((S19:S52<>"")*(S19:S52<>INDEX(S19:S52,MODE(IF(S19:S52<>"",MATCH(S19:S52,S19:S52,0)))))*(S19:S52<>INDEX(S19:S52,MODE(IF((S19:S52<>"")*(S19:S52<>INDEX(S19:S52,MODE(IF(S19:S52<>"",MATCH(S19:S52,S19:S52,0))))),MATCH(S19:S52,S19:S52,0)))))),MATCH(S19:S52,S19:S52,0))))}
T19{=IFERROR(INDEX($S$19:$S$52,MODE(IF($S$19:$S$52<>"",IF(COUNTIF($T$18:$T18,$S$19:$S$52)=0,MATCH($S$19:$S$52,$S$19:$S$52,0)*{1,1})))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.


Let us know if this works for you.
 
Upvote 0
After a little thought, I came up with this array formula that will return the nth most common value without needing the previous values:

=IFERROR(INDEX($S:$S,MOD(LARGE(IF($S$19:$S$52<>"",IF(MATCH($S$19:$S$52,$S$19:$S$52,0)=ROW($S$19:$S$52)-ROW($S$19)+1,COUNTIF($S$19:$S$52,$S$19:$S$52)+ROW($S$19:$S$52)/1000)),4),1)*1000),"")

Confirm with Control+Shift+Enter. Change the red 4 to the value you want. In case of ties, this lists the bottommost first, whereas my previous formula lists the topmost first.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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