Calculating the Median Age of a Group of People

by Allen Wyatt
(last updated July 18, 2015)

4

Jan has a worksheet that has a list of ages in column A. The ages start at 1 and go through to 100. In column B she has the number of people in each of those ages. Jan needs a formula that will tell her the median age of this group of people.

At first blush you might think that you can use the MEDIAN function to calculate the median. That function works great if you have a simple list of values. For instance, if you were calculating the median for the ages alone, then MEDIAN would work fine. However, in Jan's case she needs the median value for the ages of the people, not for the ages themselves. In other words, the median needs to be weighted by the number of people that are each age. The MEDIAN function cannot handle such a requirement.

It should be pointed out that the median age is going to be different than the average age for a group of people. The average can be calculated most easily by multiplying the age by the number of people that is each age. For instance, in column C you could place a formula such as =A1*B1 and then copy it down the column. Add up the values in columns B and C, and then divide the sum in column C by the sum in column B. The result is the average age for the list of people.

The median age, on the other hand, is the age at which half of the people fall below that age and half above that age. The median age can best be calculated by using an array formula, such as the following:

=MATCH(SUM($B$1:$B$100)/2,SUMIF($A$1:$A$100,
"<="&$A$1:$A$100,$B$1:$B$100))

This is a single formula, entered by pressing Ctrl+Shift+Enter. The SUMIF function in the formula is used to generate an array of the cumulative number of people who are less than or equal to each age. The SUM portion of the formula gives the midpoint of the total frequency of ages. The MATCH function is then used to look up the midpoint value in the array of cumulative frequencies. This yields an "index number" in the initial array, and since the array consists of the all ages 1 through 100, this index number matches is equivalent to the median age.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10595) applies to Microsoft Excel 2007, 2010, and 2013.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Setting Web Fonts

If you intend to generate a Web page from your document, you need to be concerned with the fonts that Word will use. ...

Discover More

Selecting Drawing Objects

Excel allows you to create all sorts of drawings using a wide assortment of tools. When you need to take an action upon ...

Discover More

Going to the Corners of a Selected Range

When you select a range of cells (particularly if it is a large range of cells), you may not be quite sure if you've ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Pulling Initial Letters from a String

When working with names or a different series of words, you may need to pull the initial letters from each word in the ...

Discover More

Picking Different Random Numbers from a Range

It is not unusual to need to select two random items from a list. There are a couple of ways you can approach the task; ...

Discover More

Extracting First and Last Words

When working with text phrases stored in cells, it might be helpful to be able to extract words from the phrase. In this ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is eight more than 6?

2018-03-03 12:37:46

Peter Atherton

Robin

I think that the method is floored. Median takes the middle value of the data, and if there is an even count of the data then the average of the middle two values is the median. Therefore, you should use the median function on all the data.

Say the the ranges 'Ages' has 45 values and the median is 53, you can get the same result with the following formulas where E3 contains the count
=ROUNDUP(E3/2,0) gets the mid value and
=Large(Ages,23) returns 53 the median.

If the range has 46 values then mid data points are 23 & 24
So we get the two values and average them,
=Large(ages,23)+large(Ages,24)/2

With my test data this returned 52.5, just like the median.

(see Figure 1 below)


Figure 1. 




2018-03-02 10:06:41

Robin

Here's my dilemna on finding the median age based on these age groups:

18-34 = 29%
35-54 = 34%
55+ = 38%

So 29% are between 18-34, 34% are between 35-54 and 38% are 55+ - how do I get the median age from these percentages?


2016-08-29 15:27:10

SJ

Your formula is not accepted by EXCEL.


2016-03-24 21:32:10

Eugene

Would you please explain how this works a bit more. The sumif function's arguments I cannot grasp. Why would there be a concatenation (&) when there is no logical function after the ampersand? Also I ran the whole function on five rows of fake data and it gave me #N/A... Thanks!


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.