Get MAX from a table with two criteria

RobVos

Board Regular
Joined
Feb 17, 2006
Messages
97
Office Version
  1. 2016
Platform
  1. Windows
I have a table with three columns: City, State, Rate. Each city could be included multiple times with different seasonal rates. To look up the maximum rate, I need to use both the state and the city as criteria (because a city name may not be unique - like Portland, OR and Portland, ME). If the cities were unique I would use an array formula (Excel 2016) to get the max rate for that city (criteria city and state in A1 and A2):

{=MAX(IF(Table1[Column1]=A1, Table1[Column3]))}

I want to add the state (criteria in A2, and in Table1 Column2) as an additional criteria.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
How about
Excel Formula:
=MAX(IF((Table1[Column1]=A1)*(Table1[Column2]=A2), Table1[Column3]))
 
Upvote 0
Solution
How about
Excel Formula:
=MAX(IF((Table1[Column1]=A1)*(Table1[Column2]=A2), Table1[Column3]))
Thanks - that's it - I tried putting Sumproduct in there for some reason - not thinking straight.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,472
Messages
6,125,009
Members
449,204
Latest member
tungnmqn90

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