Inbound Internet Marketing Blog

SEO, Blogging, Social Media, Landing Pages, Lead Generation and Analytics

SUBSCRIBE

The HubSpot Inbound Internet Marketing blog covers all of inbound marketing - SEO, blogging, social media, lead generation, email marketing, lead nurturing & management, and analytics. Join 57,702 others and subscribe now!

Subscribe to RSS feed Add us on Facebook! Follow us on Twitter

Get Free Marketing Info!

Get the world's best marketing resources right to your inbox! Join more than 817,000 inbound marketers!

Subscribe by email

Your email:

HubSpot's Inbound Internet Marketing Blog

Current Articles | RSS Feed RSS Feed

How to Create the Elusive Pivot Table With Medians [Excel Tip]

 

.

If you're an inbound marketer, chances are you have lots of data to analyze, and you base your most important decisions on quantitative measures. In this blog series, I discuss some the most useful tools and tricks for analyzing your data in Excel.

 In one of my earlier posts, I walked through the steps of how to create a pivot table that calculates averages for large datasets.  Unfortunately, pivot tables do not have the functionality to compute median values. Luckily, there is a workaround! You can create what is effectively a pivot table of medians by using a powerful Excel feature called the array. (Technically, it is not a pivot table, but it will give you the same results.)

I will take through the steps here, but you can also download this spreadsheet if you want to dig in more. In the example below, we have a list of customers along with their company size and their sales cycle length. The two tables (median vs. average) look at the typical sales cycle length according to company size. 

 

Median Pivot v. Avg Pivot

The "average" table was created with a pivot table. The "median" 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.
2) In the cell to the left of the "1 to 5" value, type the following: =MEDIAN(IF($A$2:$A$500=D3, $B$2:$B$500))
Here is a breakdown of what those inputs mean:
median pivot array formula

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.

3) There's just one more key ingredient needed to make this formula work. You need to press CTRL + SHIFT + ENTER while you are still active in the cell. This is how you tell Excel that you want it to create an array. Once you do this, something magical happens... you will see curly brackets {} appear around your formula. (Unfortunately, if you type in the curly brackets yourself, Excel won't understand what they mean.)

Features like this give you lots of flexibility for doing any type of marketing analysis. Give it a try and share your thoughts!
Marketing Data Box

Posted by Melissa Miller on Thu, May 12, 2011 @ 11:00 AM

COMMENTS

Pivot tables are for NORMAL PEOPLE, they are not that hard!

posted on Thursday, May 12, 2011 at 11:18 AM by Dan Tyre


And...if you want to hum a nifty tune while you do pivot tables, check out this Ball State University mathematical sciences student music video turned in as a class assignment. It rocks! Check it out! 
 
http://blogs.office.com/b/microsoft-excel/archive/2011/05/06/rockin-out-with-pivottables.aspx

posted on Saturday, May 14, 2011 at 2:13 PM by mj pierce


Comments have been closed for this article.