Loading

Got a version of Excel that uses the
menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)?
**This site is for you!** If you
use a later version of Excel, visit
our *ExcelTips* site focusing on the ribbon interface.

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.

Learn more about Allen...

ExcelTips FAQ

Ask an Excel Question

Make a Comment

Free Business Forms

Free Calendars

** Please Note:** This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later),

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 (3397) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Calculating the Median Age of a Group of People.

*Related Tips:*

**Solve Real Business Problems** Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out *Microsoft Excel 2013 Data Analysis and Business Modeling* today!

IF(ISODD(A269),INDEX(A262:B268,(MATCH(SUM(A262:A268)/2,SUMIF(B263:B268,"<="&B263:B268,A262:A268))+1),2),(INDEX(A262:B268,(MATCH(SUM(A262:A268)/2,SUMIF(B262:B268,"<="&B262:B268,A262:A268))+1),2)+INDEX(A262:B268,(MATCH(SUM(A262:A268)/2-1,SUMIF(B262:B268,"<="&B262:B268,A262:A268))+1),2))/2)

I think that the formula above solves the MEDIAN of a frequency distribution problem. Should you get an #N\A sort the frequency's ascending.

I think that the formula above solves the MEDIAN of a frequency distribution problem. Should you get an #N\A sort the frequency's ascending.

The INDEX\MATCH formula for the median below has a problem (sometimes) with frequency's of "1" in particular if that "1" frequency turns out to be the median. I'm working on it!

(INDEX(A262:B268,(MATCH(SUM(A262:A268)/2,SUMIF(B262:B268,"<="&B262:B268,A262:A268))+1),2)+INDEX(A262:B268,(MATCH(SUM(A262:A268)/2-1,SUMIF(B262:B268,"<="&B262:B268,A262:A268))+1),2))/2

Above should resolve problem outlined in my last post concerning the two numbers to be added, being different. Formula is not fully checked, be careful, good luck. Data in this case in rows A262 to B268

Freq. Aantal Personen

6 1

22 2

8 3

8 4

4 5

3 6

5 10

Median is 2.5

Above should resolve problem outlined in my last post concerning the two numbers to be added, being different. Formula is not fully checked, be careful, good luck. Data in this case in rows A262 to B268

Freq. Aantal Personen

6 1

22 2

8 3

8 4

4 5

3 6

5 10

Median is 2.5

The formula does not work, I have adjusted it as follows.

INDEX(A7:B15,(MATCH(SUM(A7:A15)/2,SUMIF(B7:B15,"<="&B7:B15,A7:A15))+1),2)

This assumes that the frequency is in column A, items in column B. Table goes from A7 to B15 and can of course be adjusted to the data. It seems to work for most cases but if the median is to occur where a summation of the middle two numbers divided by two is necessary it will not give the correct answer if the two numbers to be added are different. Column B probably needs to be in ascending order, I have not fully checked it. Good Luck!

Freq. Item

10 1

5 2

4 3

2 4

10 5

9 6

5 7

6 8

2 9

Median = 5

INDEX(A7:B15,(MATCH(SUM(A7:A15)/2,SUMIF(B7:B15,"<="&B7:B15,A7:A15))+1),2)

This assumes that the frequency is in column A, items in column B. Table goes from A7 to B15 and can of course be adjusted to the data. It seems to work for most cases but if the median is to occur where a summation of the middle two numbers divided by two is necessary it will not give the correct answer if the two numbers to be added are different. Column B probably needs to be in ascending order, I have not fully checked it. Good Luck!

Freq. Item

10 1

5 2

4 3

2 4

10 5

9 6

5 7

6 8

2 9

Median = 5

I FELT THAT THIS WAS VERY VERY USEFUL, I can now conquer excel!

I have tried this formula, but it does not appear to be correct. If I sum the number of people of either side of the resulting median age, the numbers are vastly different. The result using the above formula gives a median age of 45 years, but when I add the number of persons the median age comes out at 39 years. I under stand the median to be the age at which half of the people fall below that age and half above that age.

Your comments would be appreciated.

Your comments would be appreciated.

tried using your formula butit does not seem right.the ages I have are interval ages.how do I go about with that.?