Find the most common value if criteria met

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,404
Office Version
  1. 2016
Platform
  1. Windows
Not sure if this is possible.....

I have a column of data between P2:P100, each cell has various words in it, each on it's own line. I'm trying to find the most common value in that column but only if the cell in column B = "Destination".

I thought perhaps a MAXIF but I have no idea where to start......
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Row\Col
P​
Q​
R​
1​
2​
2​
londondestination
2​
3​
istanbuldestinationMOST FREQ
4​
paris london
5​
ottowadestination istanbul
6​
den haagdestination
7​
destination
8​
istanbuldestination
9​
londondestination
10​
paris

In R1 control+shift+enter, not just enter:

=MAX(FREQUENCY(IF(1-($P$2:$P$10=""),IF($Q$2:$Q$10="destination",MATCH($P$2:$P$10,$P$2:$P$10,0))),ROW($P$2:$P$10)-ROW($P$2)+1))

In R2 control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF(1-($P$2:$P$10=""),IF($Q$2:$Q$10="destination",MATCH($P$2:$P$10,$P$2:$P$10,0))),ROW($P$2:$P$10)-ROW($P$2)+1)=$R$1,1))

In R4 control+shift+enter, not just enter, and copy down:

=IF(ROWS($R$4:R4)>$R$2,"",INDEX($P$2:$P$10,SMALL(IF(FREQUENCY(IF(1-($P$2:$P$10=""),IF($Q$2:$Q$10="destination",MATCH($P$2:$P$10,$P$2:$P$10,0))),ROW($P$2:$P$10)-ROW($P$2)+1)=$R$1,ROW($P$2:$P$10)-ROW($P$2)+1),ROWS($R$4:R4))))
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,438
Members
449,083
Latest member
Ava19

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