# How to Calculate Median in Excel Pivot Table (2 Easy Ways)

The pivot table feature in Microsoft Excel can be used to sort, analyze, and share data, but pivot tables do not calculate median values, which can be important for analyzing growth in an organization. Below, you will learn how to calculate the median in a pivot table.

## How to Activate Power Pivot in Excel

In order to use Power Pivot, you must first activate it.

Steps:

• Go to File>> then select Options.
• A dialog box named Excel Options will pop up.
• Then select COM Add-ins from the Manage drop-down and click on Go.

• Check the box before Microsoft Power Pivot for Excel and click OK.

Thus you can activate the Power Pivot in Excel.

To show you 2 simple ways of calculating the median in Excel Pivot Table, here is a concise dataset consisting of Student Names, Student IDs, and marks.

### Method 1 â€“ Calculate Median in Pivot Table by Creating a New Measure Function

Step 1: Creating Pivot Table from Dataset

• Select the whole dataset.
• Go to Insert tab>> select Pivot Table under TablesÂ option.

• A dialog box will pop up.
• Select the Location where you want to see your pivot table.
• Check the box beside Add this data to the Data ModelÂ option.
• Click OK.

Step 2: Creating a New Measure Function

• You will see thereâ€™s a different icon and we have the ability to create a measure.

• Right-click on the icon and click on Add MeasureÂ option.

• A dialog box called Measure will pop up.
• In the Formula box, enter the following formula.
`=MEDIAN([Marks])`
• Select the Category as Number and set Decimal Places as 2.
• Click OK.

• A new measure function will be created like the image below.

#### Step 3: Calculating Median

• Put Student ID in Rows and Median Marks in Values.

• You will get your pivot table along with your calculated median.

### Method 2 â€“ Calculate Median in Pivot Table Using MEDIAN Function

Steps:

• Insert a new column named Median beside the Marks column.
• Enter the following formula in cell E5.
`=MEDIAN(IF(\$C\$5:\$C\$14=C5,\$D\$5:\$D\$14))`
• AutoFill the rest of the column’s cells, and you will get the median the same as the previously shown method.

• Select any cell in the pivot table.
• Click PivotTable Analyze>> then Change Data Source drop down>> select Change Data Source.

• A dialog box named Change PivotTable Data Source will appear.
• Specify the new source data in the Table/Range box.
• Click OK.

• In the PivotTable Fields pane, the Median field is now available.
• Drag the Median field to the ValuesÂ section.

• Select Value Field Settings from the drop-down list under the Median field in the ValuesÂ section.

• A dialog box named Value Field Settings will pop up.
• In the Summarize Values By tab, select Average from the Summarize Values ByÂ list.
• In the Custom Name box, rename the field name to “Median” (there is a space before Median).
• Click OK.

• In the pivot table, you will now see the median of each row label.

You can use the MEDIAN function to calculate the median in the pivot table.

Note: Keep in mind that in our dataset we have no repeated values (both for Student ID and Marks). Thatâ€™s why we have got the same median value for all Student IDs. If you have repeated values in your dataset, the median value will be different.

1. What is the formula to find the median from mean?

For Odd Numbers:

• If the set has an odd number of elements, let n be the total number of elements.
• The median is the value of the ((n+1)/2)th item in the given set.

For Even Numbers:

• If the set has an even number of elements, let n be the total number of elements.
• Find the two middle terms: (n/2)th and ((n/2) + 1)th terms.
• Calculate the mean (average) of these two middle terms.
• The median is obtained by taking the mean of the two middle terms: Median = ((n/2)th term + ((n/2) + 1)th term) / 2.

Â 2. What is the median formula for tables?

The median is the mean of the two middle numbers if the number of terms is even. Sort the numbers based on their size. The median is the middle term in an odd number of terms. When there are even terms, add the two middlemost terms and divide by 2.

3. What is the formula 3 median?

3 Median = 2 Mode + Mean

Hint: The relationship between mean, median, and mode is known as the empirical relationship.

Get FREE Advanced Excel Exercises with Solutions!
Nujat Tasnim

Nujat Tasnim, BSc in Computer Science and Engineering from American International University-Bangladesh, has a year-long tenure with ExcelDemy. Initially a Content Developer at SOFTEKO, she transitioned to the Software Team as Junior Software Quality Assurance Engineer. Currently serving as a Junior SQA Engineer at SOFTEKO, she excels in SDLC, STLC, and requirement analysis and possesses profound insights into OOP-related software development processes. Nujat is also proficient in design software like Photoshop and Illustrator, contributing diverse skills to her... Read Full Bio

We will be happy to hear your thoughts

Advanced Excel Exercises with Solutions PDF