Conditional median in MS Excel

前端 未结 4 635
深忆病人
深忆病人 2021-01-04 06:26

I\'m trying to calculate the conditional median of a chart that looks like this:

A  |  B
-------
x  |  1
x  |  1
x  |  3
x  |  
y  |  4
z  |  5
4条回答
  •  醉梦人生
    2021-01-04 07:12

    Perhaps to generalize it a little more, instead of this...

    {=MEDIAN(IF(A:A="x",IF(B:B<>"",B:B)))}
    

    ... you could use the following:

    {=QUARTILE.EXC(IF(A:A="x",IF(B:B<>"",B:B)),2)}
    

    Note that the curly brackets refer to an array formula; you should not place the brackets in your formula but press CTRL+SHIFT+ENTER (or CMD+SHIFT+ENTER on macOS) when entering the formula

    Then you could easily get the first and third quartile by altering the last number from 2 to 1 or 3 respectively. QUARTILE.EXC is what most commercial statistical software (e.g. Minitab) use by the way. The "regular" function is QUARTILE.INC, or for the older versions of Excel, just QUARTILE.

提交回复
热议问题