I'm having problems with a MEDIAN(IF( array formula. For example for the table below, I want to calculate the median EV/EBITDA for "all years" and for "all companies" if the sales are more than 80% in the US.

{=MEDIAN(IF(geography!$P:$P>80%,geography!$X:$X))}

{=MEDIAN(IF(geography!$P:$P<80%,geography!$X:$X))}

The thing is that my formula works for "more than", i.e. >80%. But the other way round, when trying to calculate the median EV/EBITDA multiple for all companies and all years <80% sales in the US I get 0... As you can see from the data below, this is impossible as there are companies that actually have less than 80% sales in the US (and there's lots of more data!!).

Does anyone know what the mistake is?