Search code examples
if-statementgoogle-sheetsarray-formulasmedian

Using Array Formula with Median and IF


I'm trying to find the median of a column based on two conditions. I thought using an ArrayFormula is best since there is no "medianifs"...I'm getting a result in my first cell but when I try to change the criteria in the cell beneath, you'll see I'm getting the exact same result, so I know something is wrong. Maybe the formula in the first cell isn't even the correct answer?

Here's my sheet. I'm down in P94 and P95 trying to get the median values, you'll see the formulas that I've tried thus far.


Solution

  • Based on what you are attempting, I would use a filter to narrow down the criteria.

    =MEDIAN(FILTER(N:N,F:F=O1,I:I=P1))
    

    That way the data you are taking the median of is always the exact dataset needed.