+ Reply to Thread
Results 1 to 5 of 5

Do a median without using the mean

  1. #1
    Registered User
    Join Date
    08-31-2011
    Location
    Bristol
    MS-Off Ver
    Excel 2007
    Posts
    43

    Do a median without using the mean

    Hello,

    I have 2 columns of data, call them x and y.

    Ideally I want to find the average of x, and then display the corresponding y value.

    Here is a small sample of data.
    Please Login or Register  to view this content.
    I tried using MATCH, but this isn't very reliable as the criteria for matching the values (less than) isn't great. It rarely finds the correct corresponding y value.
    Using an exact match would be good, but if I do a mean average of the x data, it might return a value which ISN'T in the table, and therefore an exact match would not be found.

    So I decided to use the median instead, which should be accurate enough for what I want.

    But the median averages results sometimes if there is an even number of data. eg. The median of 3, 4, 5 is 4. BUT the median of 3, 3, 4, 5 is 3.5. Trying to do an exact match with look up value of 3.5 in that data would not work, since 3.5 is not part of that data.

    Is there a way to get the median to select 1 data point above or below the median, rather than doing a mean average?
    Last edited by Gaz_m2k5; 03-21-2013 at 10:58 AM.

  2. #2
    Forum Contributor
    Join Date
    09-27-2012
    Location
    Florida
    MS-Off Ver
    Excel XP to 2013
    Posts
    342

    Re: Do a median without using the mean

    How about something like this?
    Please Login or Register  to view this content.
    Tom S.
    ↙ If you find my reply helpful click on the * down there on the left. Yeah that's it, right there, down on the left
    If your question is resolved, mark it SOLVED using the thread tools.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Do a median without using the mean

    Tanks idea only works if you put your values in order first (looks like they are not).
    If you are stuck on Median, try

    for low end of median
    =VLOOKUP(IF(ISEVEN(COUNT(A2:A20)), MEDIAN(A2:A20, MIN(A2:A20)), MEDIAN(A2:A20)),2,FALSE)

    for high end of median
    =IF(ISEVEN(COUNT(A2:A20)), MEDIAN(A2:A20, MAX(A2:A20)), MEDIAN(A2:A20))
    Does that work?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    08-31-2011
    Location
    Bristol
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Do a median without using the mean

    Found a simpler way to do it:

    Please Login or Register  to view this content.
    Counts the number of data values, halves that and finds the xth largest value.

    Thanks for the help!

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Do a median without using the mean

    Clever!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1