Mode for Strings

HWL

Active Member
Joined
Dec 1, 2009
Messages
462
=mode(range) will return the most repetative number in a range.

=INDEX(range,MODE(MATCH(range,range,0))) will return the most repetative string in a range EXCEPT it breaks if there is an empty cell.

Anyone know how to correct this?
Thanks
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try...

=INDEX(Range,MODE(IF(Range<>"",MATCH(Range,Range,0))))

...confirmed with CONTROL+SHIFT+ENTER.
 
Upvote 0
=mode(range) will return the most repetative number in a range.

=INDEX(range,MODE(MATCH(range,range,0))) will return the most repetative string in a range EXCEPT it breaks if there is an empty cell.

Anyone know how to correct this?
Thanks
Try something like this...

Array entered**:

=INDEX(range,MODE(IF(range<>"",MATCH(range,range,0))))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0
Thanks guys, this works perfectly in a cell. Can this work as a conditional formula? (arrays) Because I am trying to change the cell color if the cell doesn't equal the mode
 
Upvote 0
the answer is yes-- it works in a conditional formula. Thanks much. This will be really helpful!
 
Upvote 0
Is there a way to apply this to filtered rows only? What is the string mode of the filtered rows?
 
Upvote 0
Is there a way to apply this to filtered rows only? What is the string mode of the filtered rows?
Try this array formula**:

=INDEX(B6:B21,MODE(IF(SUBTOTAL(3,OFFSET(B6,ROW(B6:B21)-ROW(B6),0)),MATCH(B6:B21,B6:B21,0))))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Adjust the range to suit.
 
Upvote 0
Thanks guys, this works perfectly in a cell. Can this work as a conditional formula? (arrays) Because I am trying to change the cell color if the cell doesn't equal the mode

Try this array formula**:

=INDEX(B6:B21,MODE(IF(SUBTOTAL(3,OFFSET(B6,ROW(B6:B21)-ROW(B6),0)),MATCH(B6:B21,B6:B21,0))))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Adjust the range to suit.

This is great, now the same for if it is a value???
 
Upvote 0
This is great, now the same for if it is a value???
Try this...

Array entered**:

=MODE(IF(SUBTOTAL(3,OFFSET(B6:B21,ROW(B6:B21)-ROW(B6),,1)),B6:B21))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,634
Members
452,934
Latest member
Jdsonne31

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