Stuck on adding a single additional parameter to a MEDIAN formula. I've decided to use MEDIAN instead of AVERAGEIFS, but there is no MEDIANIFS.

=MEDIAN(IF(MARKET!E:E=A8,MARKET!M:M)) is the formula I am currently using, but I need to add an additional parameter that states if Market!D:D = "X"

I've been toying with this for an hour or so and can't get there. Any help would be much appreciated. The info I found online was far more complex than I needed, and I wasn't able to make heads or tails of it.

Thanks in advance.