# Calculating the Median Age of a Group of People

by Allen Wyatt
(last updated March 5, 2020)

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, 2013, 2016, 2019, and Excel in Office 365.

##### 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

When you allow Word to naturally flow your text through a document, you may find that the text on each page ends at a ...

Discover More

Speeding Up Printing

Changing a couple of the print settings in Excel can speed up the printing of your worksheets. This tip examines those ...

Discover More

Using Find and Replace is something quite routine in Excel, as it easily allows you to find and replace information in ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

##### More ExcelTips (ribbon)

Moving the House Number to Its Own Cell

Excel is great at manipulating data, but sometimes it is difficult to figure out the best way to do the manipulation. ...

Discover More

Identifying Missing Numbers in a Consecutive Series

If you have a series of consecutive numbers in a column, you may want to know if it really is consecutive. (In other ...

Discover More

Strange Formula Conversions

When you are getting the hang of how to put together formulas in Excel, you might run into a situation where you open a ...

Discover More
##### Subscribe

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

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 seven more than 2?

2020-03-19 23:34:08

Walter Szymanski

Thanks, Allen, this formula for Calculating the Median Age of a Group of People worked perfectly without any errors for my data. Age in full years 1 thru 104 in Column A; the number of people (several hundred in many ages) in each age in Column B. Office 365 on a Mac.

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.