Find the most common value if criteria met

sharky12345

Well-known Member
Joined
Aug 5, 2010
Messages
3,422
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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
P​
[/td][td]
Q​
[/td][td]
R​
[/td][/tr][tr][td]
1​
[/td][td] [/td][td][/td][td]
2​
[/td][/tr]
[tr][td]
2​
[/td][td] london[/td][td]destination[/td][td]
2​
[/td][/tr]
[tr][td]
3​
[/td][td] istanbul[/td][td]destination[/td][td]MOST FREQ[/td][/tr]
[tr][td]
4​
[/td][td] paris[/td][td][/td][td] london[/td][/tr]
[tr][td]
5​
[/td][td] ottowa[/td][td]destination[/td][td] istanbul[/td][/tr]
[tr][td]
6​
[/td][td] den haag[/td][td]destination[/td][td] [/td][/tr]
[tr][td]
7​
[/td][td] [/td][td]destination[/td][td] [/td][/tr]
[tr][td]
8​
[/td][td] istanbul[/td][td]destination[/td][td] [/td][/tr]
[tr][td]
9​
[/td][td] london[/td][td]destination[/td][td] [/td][/tr]
[tr][td]
10​
[/td][td] paris[/td][td][/td][td] [/td][/tr]
[/table]


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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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