Finding MAX value based on combination of two criteria

JonHaywood

New Member
Joined
Jul 23, 2014
Messages
34
Hi,
I want to show a maximum value of an array (of dates) based on a combination of two criteria (a kind of 'MAXIFS' function).
My data is a bit like this ...
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Criteria 1 met?[/TD]
[TD="align: center"]Criteria 2 met?[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]01/03/2015[/TD]
[TD="align: center"]y[/TD]
[TD="align: center"]y[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]15/06/2015[/TD]
[TD="align: center"]n[/TD]
[TD="align: center"]y[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]21/06/2015[/TD]
[TD="align: center"]y[/TD]
[TD="align: center"]y[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]08/01/2016[/TD]
[TD="align: center"]n[/TD]
[TD="align: center"]y[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]12/02/2016[/TD]
[TD="align: center"]y[/TD]
[TD="align: center"]n[/TD]
[/TR]
</tbody>[/TABLE]

I'm trying to create a formula to show the last date that both criteria were both "y" (should be "21/06/2015" from the data above).

I can use this formula (entered as an array formula) to show the last date based on one matching criteria...
Code:
=MAX(IF(C2:C6="y",A2:A6,0))
(returns "08/01/2016")

...but when I use 'AND' to choose both criteria I only get the 'value if false' returned...
Code:
=MAX(IF(AND(B2:B6="y",C2:C6="y"),A2:A6,0))
(again, entered as an array formula, returns 0)

Is the AND function not compatible with array formulae? Am I missing something basic?

If I'm barking up the wrong tree, is there another way to do this?

Many thanks

Jon
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi,

you could try

Code:
=MAX(IF(B2:B6="y",IF(C2:C6="y",A2:A6,0)))



Code:
=MAX(IF(B2:B6&C2:C6="yy",A2:A6,0))


array entered

or

Code:
=MAX(INDEX((B2:B6="y")*(C2:C6="y")*A2:A6,))

just enter
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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