Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

how can I create a formula in numbers to calculate the median value of a column X considering only a filtered population in the column Y?

I'm trying to find a formula that allows me to calculate the median value of the column "age" considering only the group "A" in the column "study arm" (that actually contains A, B and C arms).

I found a similar formula for mean (MEAN.IF) but i cannot find one for the median. So i'm trying to figure out if there is a way to build it.

I'm building a dynamic database that automatically performs descriptive statistics while entering the data.

MacBook Air, OS X El Capitan (10.11)

Posted on Nov 28, 2015 7:58 AM

Reply
Question marked as Best reply

Posted on Nov 29, 2015 1:03 AM

your best bet is to make three additional columns which only include A, B, or C arm data then you can perform operations on those columns.


Assuming your data is like this:


User uploaded file


Make the first row be a header row and

the last two rows be footer rows


Make the header in cells C1, C2, and C3 like shown above


You can make the "YA", "YB", and "YC" like this:

C2=IF($A2=RIGHT(C$1, 1), $B2, "")


this is shorthand for... select cell C2, then type (or copy and paste from here) the formula:

=IF($A2=RIGHT(C$1, 1), $B2, "")

select cell C2, copy

select cells C2 thru E11 (or the last NON-footer row of your table), paste


C12=MEDIAN(C)

C13=AVERAGE(C)

select cells C12 and C13, copy

select cells C12 thru E13, paste

5 replies
Question marked as Best reply

Nov 29, 2015 1:03 AM in response to inghi

your best bet is to make three additional columns which only include A, B, or C arm data then you can perform operations on those columns.


Assuming your data is like this:


User uploaded file


Make the first row be a header row and

the last two rows be footer rows


Make the header in cells C1, C2, and C3 like shown above


You can make the "YA", "YB", and "YC" like this:

C2=IF($A2=RIGHT(C$1, 1), $B2, "")


this is shorthand for... select cell C2, then type (or copy and paste from here) the formula:

=IF($A2=RIGHT(C$1, 1), $B2, "")

select cell C2, copy

select cells C2 thru E11 (or the last NON-footer row of your table), paste


C12=MEDIAN(C)

C13=AVERAGE(C)

select cells C12 and C13, copy

select cells C12 thru E13, paste

Nov 29, 2015 5:53 AM in response to inghi

inghi wrote:


hope developers will fix soon the missing formula in the new version!


As far as I know no major spreadsheet application has a MEDIANIF type function. In Excel you can create a one-cell "array" formula. But Numbers doesn't support array formulas. So you need the extra columns/cells as Wayne has demonstrated.


To leave a suggestion for Apple you can go to Numbers > Provide Numbers Feedback in your menu.


SG

how can I create a formula in numbers to calculate the median value of a column X considering only a filtered population in the column Y?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.