Home » excel » Excel Median for multiple conditions

Excel Median for multiple conditions

Posted by: admin March 9, 2020 Leave a comment

Questions:

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
How to&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