+ Reply to Thread
Results 1 to 9 of 9

Help with calculation of median

  1. #1
    Registered User
    Join Date
    03-26-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Help with calculation of median

    I want to calculate the median result of poll results where I know the number of votes each option received but the data isn't in the right format for the median function. For example, the Excel data looks like this:

    Please Login or Register  to view this content.
    This data shows that response 1 got 10 votes, response 2 got 15 votes and response 3 got 10 votes so the median is clearly 2. The question is how to get Excel to calculate this since the data isn't in the right format for the median function?

    First post so please be kind
    Last edited by sssss; 03-26-2010 at 09:44 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help with calculation of median

    Not sure what you mean...

    The result you want is 2? Is that because median of 1,2,3 is 2? Not sure what you really want here? Please elaborate.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-26-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Help with calculation of median

    Sorry if it wasn't clear. In the example above the dataset for the median function is;

    {1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3}

    But the data I have in my worksheet is just the totals. eg 1 occurs 10 times, 2 occurs 15 times, 3 occurs 10 times.

    The thing I'm trying to figure out is how to convert these totals into the right format for the median function.

  4. #4
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500

    Re: Help with calculation of median

    If the responses are votes, I am not sure you can calculate a median. Are reponses 1, 2, 3 ordinal? If no the answer is no to a median.

    Regards

    Dav

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help with calculation of median

    Not sure about a single formula solution at the moment... but here is a way with some helper rows...

    Assuming your data is in A1:C2

    then in A3:

    =IF(ROWS(A$3:$A3)>A$2,"",A$1) copied down as far as the most number of votes you would receive.

    Then copy formulas to columns B and C

    Then use: =MEDIAN(A3:C33)

    where I have assumed up to 30 possible number of votes (ie. formula was dragged down to Row 33)

    Maybe also possible with VBA.. but don't know how.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Help with calculation of median

    If we assume your values are in B1:D2 then perhaps:

    Please Login or Register  to view this content.
    would work for you ?

  7. #7
    Registered User
    Join Date
    03-26-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Help with calculation of median

    Thanks NBVC - that helper rows solution does convert the totals into the raw values but I think in reality there could be thousands of votes so I was hoping there would be a way to do it all within a formula

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Help with calculation of median

    Test out DonkeyOte's suggestion.

  9. #9
    Registered User
    Join Date
    03-26-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Help with calculation of median

    @DonkeyOte - your solution works perfectly! Many thanks for the prompt help

+ 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