Median in Pivot Table in Excel 2010?

18

1

Astonishing that this functionality is not present in such an ancient application

Is there a known workaround?

I'm on about the part where you can change the aggregation type for a value field: It has sum, min, max, avg etc but not median

adolf garlic

Posted 2012-03-07T10:03:24.573

Reputation: 1 618

1IF memory serves, Excel's aggregate functions are closely related to SQL's aggregate functions-and you won't find a Median function there either. A SQL work-around may give some insight into creating an Excel Pivot table version. – dav – 2012-08-24T17:10:58.293

You may be able to leverage Powerpivot to do what you need, see this article: http://javierguillen.wordpress.com/2011/09/13/quartile-percentile-and-median-in-powerpivot-dax/.

– dav – 2012-08-24T17:14:35.260

Answers

7

For simple examples you can use array formulas instead of a PivotTable.

If you have the source data in rows 10:1000, category designations of the source data in column A, the source data values in column C, and the category being considered in G3, the following array formula will find the median:

{=MEDIAN(IF($A$10:$A$1000=G3,$C$10:$C$1000))}

Commit the entry with Ctrl+Shift+Enter, and copy down for the categories in G4, G5 etc

Levi

Posted 2012-03-07T10:03:24.573

Reputation: 516

2Looks like there is typo for value where instead of $C$10, $C$100 is there. – jhamu – 2016-06-09T23:23:27.553

1

The quickest and simplest way to get a median in your pivot tables is to import your Excel file into Google Sheets. There you can create a pivot table and use a median.

Jeff Gebhart

Posted 2012-03-07T10:03:24.573

Reputation: 21

I had to vote this up because it's by far the easiest way to get the results. Doesn't help in excel, but the same data can be processed there in a pinch. – Dan – 2018-03-09T02:39:24.660

No good if you have sensitive data – adolf garlic – 2018-04-04T11:31:02.130

1

Unfortunately, there is nothing built in to excel's pivot table function that will do this. You could try this add-on though. It claims to be able to do it, but I've never used it.

You could do the median work with the data and then include it in pivot table data, but at that point.. you know.. what's the point of the table..

Raystafarian

Posted 2012-03-07T10:03:24.573

Reputation: 20 384

1

You can actually use the iserror function to exclude the total rows from medians. For example, if the Total row labels are in row A and the data you want the median of is in row I:

=MEDIAN(IF(ISERROR(FIND("Total",$A$5:$A$65535)),I5:I35535))

Thomas Cleberg

Posted 2012-03-07T10:03:24.573

Reputation: 11

0

I have found a turnaround if you want to quickly obtain some specific median values in your pivot table: Not perfect, but it could help in some situations..

  • Double click in your pivot table on the aggregated value you want the median calculated
  • Excel open a new sheets with all the rows behind this aggregated value
  • Select the desired range of values and click on "Data Analysis" in the Excel's Data tab (you may need to activate it first)
  • Choose "Descriptive Statistics"
  • Adjust carefully your parameters (See Help of this function)
  • Excel will calculate a whole bunch of Descriptive Statistics in a new sheet by default

Fabien

Posted 2012-03-07T10:03:24.573

Reputation: 327

0

As Dav commented above, you can use the free PowerPivot addon (may require a newer version of excel). Worked for me in excel 2016. See this article: https://www.masterdataanalysis.com/ms-excel/calculating-median-excel-pivottables/

Decio

Posted 2012-03-07T10:03:24.573

Reputation: 41

External links can break or be unavailable, in which case your answer would not add anything useful useful. Please include the essential information within your answer and use the link for attribution and further reading. Thanks. – fixer1234 – 2019-01-17T01:00:10.380

0

there's a way to do median (or any formula) if your pivot table is simple (does not have sub totals in the table). other than that, there's no other way to gracefully include median calcs in your pivot table.

too bad can't include attachments... i'll do a snapshot of my example:

i used the offset function described here: http://www.myonlinetraininghub.com/excel-offset-function-explained also, download the workbook and go to the pivot table tab - that's where i did my example

this is the end result - see image here:

enter image description here

NOTE: you cannot put the median/offset formula cell in the same column that you are grabbing median value from. ALSO, the offset allows you to grab median value from the value of the column less the grand total row.

unfortunately, there's no graceful way to do median (or any other) calc when you're working with a more complex pivot table (i.e., that has subtotals in the pivot table).

Prospertute

Posted 2012-03-07T10:03:24.573

Reputation: 1