Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel Median for multiple conditions

Basically in excel I want a table, like the one given below on the right (the scale of my data is a lot bigger than the example given),that has the median for each subject, for each condition (e.g. TADA, TADP, TPDA, TPDP). Ideally, I would use a pivot table, however, excel does not do 'median' in a pivot table. I was wondering if there was a formula I could to save me having to go through manually and working out the median, i've tried a few (along to lines of "median(if etc.." but my coding knowledge in excel is very poor. Is there a short way to do this?

 Data                               Table
Subject    RT  condition            Subject    TADA   TADP  TPDA  TPDP
  1        23  TADA                    1
  1        54  TPDA                    2
  1        65  TADA                    3
  1        67  TPDP
  1        76  TADA
  2        72  TPDA
  2        87  TADA
  2        12  TPDP
  2        45  TADP
  2        32  TPDP
  2        87  TADA
  3        98  TPDA
  3        12  TADA
  3        53  TPDA
  3        78  TADP
  3        98  TPDP
like image 602
user1586974 Avatar asked Sep 26 '13 11:09

user1586974


People also ask

How do you find the median with multiple criteria?

Median IF – Multiple Criteria You can also calculate a median based on multiple criteria by using Boolean Logic. If both criteria are TRUE then it will calculate as TRUE, but if one (or more) criteria is FALSE it will calculate as FALSE.

Can you do a median IF statement in Excel?

The MEDIAN function finds the middle value out of a set of numbers. The IF function allows us to set conditions for the values we want to examine. The array formula lets the IF function test for multiple conditions in a single cell.


1 Answers

Assuming data in A2:C100 and then your results table with headers in F1 across and row labels in E2 down you can use an array formula like this in F2

=MEDIAN(IF($A$2:$A$100=$E2,IF($C$2:$C$100=F$1,$B$2:$B$100)))

confirmed with CTRL+SHIFT+ENTER and copied across and down

extend data ranges as required

like image 178
barry houdini Avatar answered Sep 19 '22 22:09

barry houdini