+ Reply to Thread
Results 1 to 11 of 11

Weighted Percentile Calculation Help

  1. #1
    Registered User
    Join Date
    07-11-2014
    Location
    arizona
    MS-Off Ver
    MS 13
    Posts
    4

    Weighted Percentile Calculation Help

    First time poster. Have looked all over and have not been able to find a solution for what I'm looking to do.

    I'm dealing with a very large data and need to calculate a weighted percentile. For example, in this sample data set below, I want to find the 25th percentile of the Value column weighted by the Qty column. Obviously, I can calculate the percentile of a single column, but when I need to incorporate the weights of the values, I get lost.

    Would love some help adding in some helper columns and creating a formula that would allow me to calculate a weighted percentile. Cheers!

    sampledata.PNG
    Attached Images Attached Images

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,462

    Re: Weighted Percentile Calculation Help

    Welcome to the forum!

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-11-2014
    Location
    arizona
    MS-Off Ver
    MS 13
    Posts
    4

    Re: Weighted Percentile Calculation Help

    Thanks for the tips! Excel workbook is attached.

    Columns A-C have the sample data to manipulate.

    Column H-K manually lists out all of the values and performs the desired percentile calculation. I need a formula that can calculate this without individually listing all of the values, or a macro that can transform the data set so that I can do a basic PERCENTILE.INC calc.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,881

    Re: Weighted Percentile Calculation Help

    Here is a formula that will 'transform the data set so that you can do a basic PERCENTILE.INC calc', assuming that the list was supposed to have had 289 listed once and 204 listed twice as indicated by the quantities in column C:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    07-11-2014
    Location
    arizona
    MS-Off Ver
    MS 13
    Posts
    4

    Re: Weighted Percentile Calculation Help

    Very impressive, JeteMC, I nearly have it!

    I am running into a problem as I rewrote the formula to a larger data set. Any idea why on this formula stops working at row 38 and starts producing repeating values?

    EDIT: I see the problem with the formula, though not quite sure how to fix. When there is a repeated value in column C, it throws off the COUNTIFS and INDEX(MATCH formulas and references the first instance of the repeated value.

    Thanks so much for the help!
    Attached Files Attached Files
    Last edited by g3diamondback; 11-29-2016 at 05:46 PM.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,881

    Re: Weighted Percentile Calculation Help

    The formula in column H, which has become a helper column and could be moved/hidden for aesthetic purposes, has been modified to INDEX the item numbers as those don't repeat:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    A formula now populates column I with the values:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The percentile formulas now reference column I (I also modified them to reference column J instead of hard coding in the percentiles, which gives the user the ability to easily change):
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let us know if you have any questions.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-11-2014
    Location
    arizona
    MS-Off Ver
    MS 13
    Posts
    4

    Re: Weighted Percentile Calculation Help

    That got me what I needed. I was taking a while to confirm that I could pull the formula down to my real data set (~170k rows) without it crashing and after a few hours of calculating, it all worked out.

    Thanks a bunch for the help. Rep'd!

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,881

    Re: Weighted Percentile Calculation Help

    You're Welcome a bunch. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

  9. #9
    Registered User
    Join Date
    10-23-2019
    Location
    California
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Weighted Percentile Calculation Help

    I have a similar question to the original poster, but my weights are not necessarily whole numbers. Does this method work for that as well? If not, do you know how it can be modified to accommodate that?

    Thanks for any help!

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,881

    Re: Weighted Percentile Calculation Help

    Administrative Note:

    Hello carofranes and Welcome Excel Forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

    Let us know if you have any questions.

  11. #11
    Registered User
    Join Date
    06-08-2023
    Location
    Idaho, USA
    MS-Off Ver
    365
    Posts
    1

    Re: Weighted Percentile Calculation Help

    This thread has helped me so much in a project I am working on! Thank you to everyone who contributed here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Custom Function for Weighted Percentile
    By Agferna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2014, 02:54 PM
  2. Percentile calculation
    By matjeng in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-16-2014, 02:02 AM
  3. Calculation weighted average of Percent Change
    By bml63 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-24-2013, 11:34 AM
  4. Trying to do percentile calculation with Pivot
    By Roy3125 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 11-25-2012, 04:19 AM
  5. array calculation and percentile
    By ianbec in forum Excel General
    Replies: 2
    Last Post: 06-16-2011, 01:50 AM
  6. Percentile calculation with 2 conditions
    By soakaos in forum Excel General
    Replies: 3
    Last Post: 05-06-2010, 11:19 AM
  7. Percentile calculation
    By mbuckley56 in forum Excel General
    Replies: 8
    Last Post: 02-13-2010, 08:28 PM

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