How to Create an Excel Pivot Table With Medians

Sophia Bernazzani Barron
Sophia Bernazzani Barron

Published:

As a marketer, you already know that Microsoft Excel is a powerful tool for sorting, analyzing, and sharing data. Trouble is, some of the most beneficial formulas are really tough to figure out -- even for us data-crunchers. 

For example, we've walked through the steps of how to create a pivot table before, but unfortunately pivot tables don't compute median values, which can be highly useful information with which organizations can analyze their growth.

Luckily, there is a workaround in Excel called the array, where you can use formulas to calculate the median of a data set. We'll walk you through how to do that in the example below, which features a list of customers along with their company size and sales cycle length. For context, the two tables (average vs. median) look at the typical sales cycle length for each company size.

Download 10 Excel Templates for Marketers [Free Kit]

Ready to see how it works? Download the file here to follow along with the instructions below.

The Excel Pivot Table Alternative for Calculating Median

Excel_screen_grab-1.png

The "Average of Sales Cycle (Days)" table was created with a pivot table. The "Median of Sales Cycle (Days)" table was created by doing the following:

1) Create a column with the six possible "employees" options: 1 to 5, 6 to 10, 11 to 15, etc.

EXstep1.png

2) In the cell to the right of the "1 to 5" value, type the following:  =MEDIAN(IF($A$2:$A$20=D2, $B$2:$B$20))

ex2.png

3) When you've closed the final parenthesis and while you're still in the cell, type Control+Shift+Enter (on a PC) or Command+Shift+Enter (on a Mac) to populate the median. This is how you tell Excel that you want to create an array.

Note: Once you do this, you will see curly brackets { } appear around your formula. If you type in the curly brackets yourself or copy/paste the formula above into the cell, Excel won't understand what they mean.

ex3.png

4) Copy the median amount in the first cell (G2 in the example) into the rest of the empty cells in the table (G3-G7 in the example).

ex4.png

Here is a breakdown of what these formula inputs mean: 

median_formula.png
  1. This is the column of values for "# of Employees" in Column A
  2. This is the contents of cell D2: "1 to 5"
  3. This is the column of values for "Sales Cycle (Days)" in Column B

Translation: First, the IF statement finds all rows where the # of Employees = "1 to 5"; it then stores all of the corresponding "sales cycle" values in an array. The MEDIAN function then pulls the median out of that array of sales cycles for the "1 to 5" customers.

When to Use Median to Analyze Data

Average (or mean) and median are common measures of data, but generally speaking average is more commonly used than median.

While average is a helpful way to determine what a typical member of a data set looks like, in some cases, median actually provides a fuller picture of a data set within its context.

In fact, average can actually be misleading if the data set is highly skewed and a large set of the population is similar with several far-away outliers. In such cases, the median is a better indicator of what a typical member of the data set looks like.

For example, in the United States, household income is commonly measured and referred to in terms of the median. This could be due to the fact that high-income inequality nationwide would make the average a poor representation of a typical American household's income. 

Here's another scenario: If a business were analyzing sales, it would be important for them to consider the types of data in the sets they were analyzing. For example, calculating the average amount of total monthly sales would be a good indicator of performance because each month has roughly the same number of days and opportunities to sell, so the average would show what a baseline expectation of productivity would be.

However, the average may not be the best measure to analyze each sale's size that year. If the organization sold products varying in price from $10 to $25,000, then the average sale size might be skewed by the lowest and highest prices. Instead, the median would give the organization an idea of if sales were typically higher or lower in price. See the difference?

Ultimately, analyzing both the average and the median will provide the most full picture possible of your organization's raw data, and pivot tables in Excel, such as the ones above, can help you analyze both data sets.

Want more Excel tips? Check out this list of Excel shortcuts

excel marketing templates
 excel templates
Topics: Excel

Related Articles

We're committed to your privacy. HubSpot uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.

Tired of struggling with spreadsheets? These free Microsoft Excel templates can help.

Marketing software that helps you drive revenue, save time and resources, and measure and optimize your investments — all on one easy-to-use platform

START FREE OR GET A DEMO