+ Reply to Thread
Results 1 to 14 of 14

How to do a weighted median?

  1. #1
    Registered User
    Join Date
    11-02-2006
    Posts
    3

    How to do a weighted median?

    Is there any way to do a weighted median in Excel?

    Consider this example:

    Project.....Duration.....Units
    ---------------------------
    a.............10.............3.....
    b.............20.............2.....
    c.............30.............5.....

    I'm trying to get a median of duration, not based on project, but weighted by units.

    If I do a =MEDIAN(duration column), that will give me median by project. To get the more accurate number, I need to explode out the above chart to look like this:

    Project.....Duration
    ------------------
    a.............10.......
    a.............10.......
    a.............10.......
    b.............20.......
    b.............20.......
    c.............30.......
    c.............30.......
    c.............30.......
    c.............30.......
    c.............30.......

    Now if I do =MEDIAN(duration column) it will be weighted by units.

    The big question is though, is there a way in Excel to do the calculation on the first table, without exploding it into the second table?

    Thanks!
    Last edited by bnelson333; 11-02-2006 at 11:02 AM.

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    With an array formula Control Shift Enter instrad of Enter

    Please Login or Register  to view this content.
    HTH
    Carim

  3. #3
    Registered User
    Join Date
    11-02-2006
    Posts
    3
    Thanks for the reply Carim. Unfortunately that doesn't seem to work.

    In the tables I gave, median of duration on table 1 = 20. Median of duration on table 2 = 30 (this is the # I'm looking for), but the value from your formula is 220.

    Even if I replace SUM with MEDIAN in your formula, it gives 40, not 30.

    You're thinking how I am, but I just haven't been able to visualize the calculation needed to figure this out.

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Sorry ...
    I though you meant weighted average ...

    Median : =Median(B1:B3)

    HTH
    Carim

  5. #5
    Registered User
    Join Date
    11-02-2006
    Posts
    3
    That only gives me median of duration. I need median of duration, weighted by units.

  6. #6
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by bnelson333
    Thanks for the reply Carim. Unfortunately that doesn't seem to work.

    In the tables I gave, median of duration on table 1 = 20. Median of duration on table 2 = 30 (this is the # I'm looking for), but the value from your formula is 220.

    Even if I replace SUM with MEDIAN in your formula, it gives 40, not 30.

    You're thinking how I am, but I just haven't been able to visualize the calculation needed to figure this out.
    I don't know of any way to do it with excel functions without a helper column (at the least).

    The only suggestion I can offer is that you will probably have to write your own function in VBA to do this. If you stick it with the worksheet, it will be portable provided whomever you give it to doesn't disable the macros.

    Scott

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    For the sake of clarification, is the median you are looking for 25 ?

  8. #8
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Attached is a sample for weighted median.
    Let me know if it is what you expected ...

    Carim
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-12-2011
    Location
    Tennessee
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: How to do a weighted median?

    Carim,

    I tried this and it doesn't work if you plug in any other numbers.

  10. #10
    Registered User
    Join Date
    01-21-2016
    Location
    Portland, Oregon
    MS-Off Ver
    Mac 2011
    Posts
    4

    Re: How to do a weighted median?

    Is it really the case that Excel can't calculate a weighted median? I need to calculate the median wage for various job positions in an industry. For each job position, wages are in one column, and the number of people at each facility who are paid that wage are counted in another column. For example,

    Col.A.......Col.B
    4.........$11.00
    3.........$12.00
    8.........$10.00
    2.........$12.00
    1.........$17.00
    5.......... $9.25

    I have about 700 entries, so there is no way I am going to create helper columns for this, and I shouldn't have to. A weighted median seems like a very basic and commonly needed calculation that Excel should easily be able to do. Right?

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: How to do a weighted median?

    jhinkel, welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  12. #12
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: How to do a weighted median?

    Hi FDibbins,
    Not sure if I did something wrong, but I was replying to OP's post.

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: How to do a weighted median?

    jewelsharma I had already posed that the member needs to start a new thread, and not post questions on another member's thread, wait til they post their own thread, then respond on that 1

  14. #14
    Registered User
    Join Date
    01-21-2016
    Location
    Portland, Oregon
    MS-Off Ver
    Mac 2011
    Posts
    4

    Re: How to do a weighted median?

    Hi, Thanks for the direction, and my apologies for posting before becoming more familiar with the rules.

    I reposted my question in a new thread. My question about the weighted median in Excel is basically the same issue as the one being discussed here. I'm not sure this thread was ever resolved, so people interested in this post may also find the weighted median question in my post interesting: http://www.excelforum.com/excel-form...ed-median.html

+ 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