# Excel: PivotTable with the median function

PivotTables do not allow median function. We will create a helper column and use an array function to calculate the median in a PivotTable. Also shown are average, median, averageif, if statement with the median function.

The median function finds the middle number in a range. If you have an odd number of numbers (3, 7, 15 numbers) it will find the middle number. If you have an even number of numbers, (2, 14, 28) if will find the two middle numbers and average them.

## Functions used in the video above

1. Average – Returns the average (arithmetic mean) of the arguments. For example, if the range A1:A20 contains numbers, the formula =AVERAGE(A1:A20) returns the average of those numbers.
2. Median – Returns the statistical median (the middle value) of a list of supplied numbers.
3. If
4. Array Function
5. AverageIf – returns the average (arithmetic mean) of all numbers in a range of cells, based on a given criterion. The AVERAGEIF function is a built-in function in Excel that is categorized as a Statistical Function.

There is no medianif function so we nested the median function with an if statement and made it an array function.

##### Chris Menard

Chris is a Microsoft Office Master Instructor. He trains corporate clients in Microsoft Office Excel, PowerPoint, Word, and Outlook. Menard is a speaker for the Georgia Society of CPAs and the University of Georgia. When he's not training, he blogs about technology and creates training videos on YouTube. Currently, there are over 400 technology videos available on his YouTube Channel.