Excel array formula for max with multiple/ variable criteria
I have a sheet that contains 365 rows, representing dates from a referred Start Date (for the following year). There are about 30 columns each of which has an agency name.
The cells in the sheet contain calculated agency populations for each date.
This is a reference sheet: "DailyPopulation"
In the ReportSheet
the user defines a Period Start Date and Period End Date
I'm trying to construct an array formula that displays the max population for each agency within the defined period, separately (of course) I also want the min.
Where your Start Date is in B1
, your End Date is in B2
, all the dates are in A2:A366
on the DailyPopulation sheet, and the data for the agency in question is in B2:B365
on the DailyPopulation sheet, you can use the following array formula.
=MAX(IF($B$1<=DailyPopulation!$A$2:$A$366,IF($B$2>=DailyPopulation!$A$2:$A$366,DailyPopulation!B$2:B$366,""),""))
Remember you must enter the formula by pressing Ctrl+Shift+Enter. If you arrange your ReportSheet with each agency in a different column, you can fill this formula to the right.
To find the minimum, just replace MAX
with MIN
.