Closed Thread
Results 1 to 36 of 36

weighted percentile

  1. #1
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    weighted percentile

    I am trying to get a weighted 90th percentile for the transit time by lane in the attached file. In attached, column A is the lane, B is the executed transit time and C is the number of units for that lane and transit time. I need to weight each transit time and find the 90th percentile for each lane based on the weighted transit times. This is a small sample of a much larger data set. Help greatly appreciated!!!
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: weighted percentile

    OK. A question to begin with. Exactly (mathematically) what do you mean by "weighted"? I have, however, made a guess...

    To return a list of unique lanes, in F2, copied down:
    =IFERROR(INDEX($A$2:$A$89,MATCH(0,INDEX(COUNTIF($F$1:$F1,$A$2:$A$89),0),0)),"")

    To return the 90th percentile, an array formula in G2, copied down:
    =IF(F2="","",PERCENTILE.EXC(IF(TRANSPOSE(ROW(INDIRECT("1:"&MAX($C$2:$C$89))))<=$C$2:$C$89,IF($A$2:$A$89=F2,$B$2:$B$89,"")),0.9))

    It is a bit slow.... but it does get there. Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    I think it's more complicated than that.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: weighted percentile

    So do I... but I felt I had to start somewhere...

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: weighted percentile

    Wikipedia (https://en.wikipedia.org/wiki/Weight...centile_method ) observes that "There is no standard function for a weighted percentile." With that in mind, the first step will be to define exactly what you mean by and how you want to calculate weighted percentiles. You might review the formulas proposed by the Wikipedia article and see if those formulas would adequately address your question. They are not difficult formulas, and should be easily programmed into Excel.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    If you aggregate quantities by time, ...

    G
    H
    I
    J
    K
    1
    Time
    Qty
    Midpt Pctile
    2
    2
    48
    0.004%
    I2: =(H2 - G2/2) / $C$90
    3
    8
    58,837
    5.051%
    4
    9
    84,515
    7.256%
    5
    10
    115,237
    9.893%
    6
    11
    255,107
    21.902%
    7
    12
    445,397
    38.239%
    8
    13
    554,899
    47.641%
    9
    14
    751,288
    64.502%
    10
    15
    908,599
    78.007%
    11
    16
    1,009,306
    86.654%
    12
    17
    1,044,938
    89.713%
    13
    19
    1,068,671
    91.750%
    14
    35
    1,074,782
    92.274%
    15
    36
    1,076,532
    92.425%
    16
    37
    1,101,815
    94.595%
    17
    40
    1,106,768
    95.020%
    18
    41
    1,130,896
    97.092%
    19
    43
    1,144,069
    98.223%
    20
    44
    1,153,281
    99.014%
    21
    45
    1,156,718
    99.309%
    22
    47
    1,164,749
    99.998%
    23
    24
    25
    Time
    Percentile
    26
    17.28
    90%
    G26: =PERCENTILE($G$2:$G$22, PERCENTRANK($I$2:$I$22, 90%))
    Last edited by shg; 11-09-2018 at 12:24 PM.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    I just noticed the segregation by lane, which Glenn's suggestion considers and mine does not.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    It appears Elvis has left the building.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: weighted percentile

    Indeed. Another hit and run poster...???

  10. #10
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    Re: weighted percentile

    No hit and run, just have been away! To answer your question, if I have a lane say Shanghai to LA and I have 30 shipments this month, I would want to "weight" them based on the number of units so that if the transit time was 15 days for 1,000 units and it was 25 days for 10,000 units, the 10,000 units would be weighted 10x that of the 15 day transit. I have searched and tried and cannot figure out how to do such a thing! I really appreciate the help, sorry for my absence from the post.

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    A
    B
    C
    D
    1
    Lane
    Time
    Wgt
    2
    CholomaFort WorthOct 2018
    8
    29,275
    3
    CholomaFort WorthOct 2018
    8
    1,875
    4
    CholomaFort WorthOct 2018
    8
    27,639
    5
    CholomaFort WorthOct 2018
    9
    746
    6
    CholomaFort WorthOct 2018
    9
    5,935
    7
    CholomaFort WorthOct 2018
    9
    18,997
    8
    CholomaFort WorthOct 2018
    11
    28,491
    9
    CholomaFort WorthOct 2018
    11
    5,052
    10
    CholomaFort WorthOct 2018
    11
    25,631
    11
    CholomaFort WorthOct 2018
    11
    6,455
    12
    CholomaFort WorthOct 2018
    11
    22,179
    13
    CholomaFort WorthOct 2018
    12
    17,950
    14
    CholomaFort WorthOct 2018
    12
    3,739
    15
    CholomaFort WorthOct 2018
    12
    26,075
    16
    CholomaFort WorthOct 2018
    12
    30,832
    17
    CholomaFort WorthOct 2018
    12
    29,663
    18
    CholomaFort WorthOct 2018
    12
    28,903
    19
    CholomaFort WorthOct 2018
    12
    28,879
    20
    CholomaFort WorthOct 2018
    12
    24,249
    21
    CholomaFort WorthOct 2018
    13
    23,756
    22
    CholomaFort WorthOct 2018
    13
    13,417
    23
    CholomaFort WorthOct 2018
    13
    16,885
    24
    CholomaFort WorthOct 2018
    13
    28,351
    25
    CholomaFort WorthOct 2018
    14
    512
    26
    CholomaFort WorthOct 2018
    14
    1,502
    27
    CholomaFort WorthOct 2018
    14
    605
    28
    CholomaFort WorthOct 2018
    14
    2,565
    29
    CholomaFort WorthOct 2018
    14
    22,117
    30
    CholomaFort WorthOct 2018
    14
    3,111
    31
    CholomaFort WorthOct 2018
    14
    26,892
    32
    CholomaFort WorthOct 2018
    14
    9,727
    33
    CholomaFort WorthOct 2018
    14
    18,571
    34
    CholomaFort WorthOct 2018
    14
    2,821
    35
    CholomaFort WorthOct 2018
    14
    28,031
    36
    CholomaFort WorthOct 2018
    14
    6,057
    37
    CholomaFort WorthOct 2018
    14
    22,494
    38
    CholomaFort WorthOct 2018
    15
    7,784
    39
    CholomaFort WorthOct 2018
    15
    22,198
    40
    CholomaFort WorthOct 2018
    15
    30,803
    41
    CholomaFort WorthOct 2018
    15
    3,033
    42
    CholomaFort WorthOct 2018
    15
    25,042
    43
    CholomaFort WorthOct 2018
    15
    159
    44
    CholomaFort WorthOct 2018
    15
    188
    45
    CholomaFort WorthOct 2018
    16
    2,731
    46
    CholomaFort WorthOct 2018
    16
    26,507
    47
    CholomaFort WorthOct 2018
    16
    28,667
    48
    CholomaFort WorthOct 2018
    16
    19,450
    49
    CholomaFort WorthOct 2018
    16
    23,352
    50
    CholomaFort WorthOct 2018
    17
    6,150
    51
    CholomaFort WorthOct 2018
    17
    5,564
    52
    CholomaFort WorthOct 2018
    17
    23,918
    53
    CholomaFort WorthOct 2018
    19
    23,733
    54
    Ho Chi Minh CityFort WorthOct 2018
    35
    3,153
    55
    Ho Chi Minh CityFort WorthOct 2018
    35
    2,958
    56
    Ho Chi Minh CityFort WorthOct 2018
    36
    940
    57
    Ho Chi Minh CityFort WorthOct 2018
    36
    810
    58
    Ho Chi Minh CityFort WorthOct 2018
    37
    3,768
    59
    Ho Chi Minh CityFort WorthOct 2018
    37
    11,835
    60
    Ho Chi Minh CityFort WorthOct 2018
    37
    2,989
    61
    Ho Chi Minh CityFort WorthOct 2018
    40
    3,958
    62
    Ho Chi Minh CityFort WorthOct 2018
    40
    995
    63
    Ho Chi Minh CityFort WorthOct 2018
    43
    10,520
    64
    Ho Chi Minh CityFort WorthOct 2018
    43
    2,653
    65
    Ho Chi Minh CityFort WorthOct 2018
    44
    9,212
    66
    Ho Chi Minh CityFort WorthOct 2018
    45
    3,437
    67
    Ho Chi Minh CityFort WorthOct 2018
    47
    1,600
    68
    Ho Chi Minh CityFort WorthOct 2018
    47
    1,200
    69
    ManaguaFort WorthOct 2018
    2
    48
    70
    ManaguaFort WorthOct 2018
    10
    30,722
    71
    ManaguaFort WorthOct 2018
    11
    27,680
    72
    ManaguaFort WorthOct 2018
    11
    24,382
    73
    ManaguaFort WorthOct 2018
    13
    27,093
    74
    ManaguaFort WorthOct 2018
    14
    25,153
    75
    ManaguaFort WorthOct 2018
    14
    21,235
    76
    ManaguaFort WorthOct 2018
    14
    2,489
    77
    ManaguaFort WorthOct 2018
    14
    2,507
    78
    ManaguaFort WorthOct 2018
    15
    2,361
    79
    ManaguaFort WorthOct 2018
    15
    1,331
    80
    Phnom PenhFort WorthOct 2018
    41
    24,128
    81
    Phnom PenhFort WorthOct 2018
    47
    2,636
    82
    Phnom PenhFort WorthOct 2018
    47
    2,595
    83
    84
    CholomaFort WorthOct 2018
    14.14
    90%
    B84: =WgtPercentileIf($A$2:$A$82, A84, $B$2:$B$82, $C$2:$C$82, C84)
    85
    Ho Chi Minh CityFort WorthOct 2018
    44.05
    90%
    86
    ManaguaFort WorthOct 2018
    14.47
    90%
    87
    Phnom PenhFort WorthOct 2018
    46.87
    90%

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    I had to whack some rows to post it. Here's the code:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    Re: weighted percentile

    THANK YOU!!!! I am trying it now, appreciate the help.

  14. #14
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    Re: weighted percentile

    It works but I need it to return what the 90th percentile would be for each lane, can that be done? I was using {=PERCENTILE.INC(IF(AX$1484:AX$2037=AX1484,AL$1484:AL$2037),0.9)} but that does not take the units/qty weight into account.

  15. #15
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    Quote Originally Posted by cynthiarb View Post
    It works but I need it to return what the 90th percentile would be for each lane, can that be done?
    Did you happen to look at the last four lines of post 11?

  16. #16
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    Fixed a bug

    A
    B
    C
    1
    Lane
    Time
    Wgt
    2
    Ho Chi Minh CityFort WorthOct 2018
    37
    2,989
    3
    CholomaFort WorthOct 2018
    15
    7,784
    4
    CholomaFort WorthOct 2018
    17
    5,564
    5
    CholomaFort WorthOct 2018
    12
    29,663
    6
    CholomaFort WorthOct 2018
    12
    26,075
    7
    Ho Chi Minh CityFort WorthOct 2018
    43
    2,653
    8
    CholomaFort WorthOct 2018
    14
    2,565
    9
    CholomaFort WorthOct 2018
    8
    29,275
    10
    CholomaFort WorthOct 2018
    8
    27,639
    11
    CholomaFort WorthOct 2018
    15
    3,033
    12
    ManaguaFort WorthOct 2018
    14
    25,153
    13
    CholomaFort WorthOct 2018
    15
    25,042
    14
    CholomaFort WorthOct 2018
    14
    28,031
    15
    CholomaFort WorthOct 2018
    14
    1,502
    16
    ManaguaFort WorthOct 2018
    11
    24,382
    17
    CholomaFort WorthOct 2018
    11
    22,179
    18
    CholomaFort WorthOct 2018
    15
    188
    19
    CholomaFort WorthOct 2018
    14
    6,057
    20
    ManaguaFort WorthOct 2018
    14
    2,507
    21
    CholomaFort WorthOct 2018
    12
    28,879
    22
    CholomaFort WorthOct 2018
    17
    6,150
    23
    ManaguaFort WorthOct 2018
    2
    48
    24
    ManaguaFort WorthOct 2018
    14
    21,235
    25
    ManaguaFort WorthOct 2018
    15
    1,331
    26
    CholomaFort WorthOct 2018
    14
    3,111
    27
    CholomaFort WorthOct 2018
    16
    19,450
    28
    Ho Chi Minh CityFort WorthOct 2018
    44
    9,212
    29
    Ho Chi Minh CityFort WorthOct 2018
    47
    1,600
    30
    CholomaFort WorthOct 2018
    11
    25,631
    31
    CholomaFort WorthOct 2018
    11
    6,455
    32
    CholomaFort WorthOct 2018
    13
    23,756
    33
    Ho Chi Minh CityFort WorthOct 2018
    35
    3,153
    34
    CholomaFort WorthOct 2018
    9
    746
    35
    ManaguaFort WorthOct 2018
    15
    2,361
    36
    CholomaFort WorthOct 2018
    12
    28,903
    37
    CholomaFort WorthOct 2018
    11
    5,052
    38
    Ho Chi Minh CityFort WorthOct 2018
    35
    2,958
    39
    Ho Chi Minh CityFort WorthOct 2018
    37
    3,768
    40
    CholomaFort WorthOct 2018
    13
    13,417
    41
    CholomaFort WorthOct 2018
    8
    1,875
    42
    Ho Chi Minh CityFort WorthOct 2018
    47
    1,200
    43
    CholomaFort WorthOct 2018
    14
    26,892
    44
    CholomaFort WorthOct 2018
    12
    3,739
    45
    CholomaFort WorthOct 2018
    9
    18,997
    46
    Phnom PenhFort WorthOct 2018
    41
    24,128
    47
    Ho Chi Minh CityFort WorthOct 2018
    40
    3,958
    48
    Ho Chi Minh CityFort WorthOct 2018
    36
    940
    49
    CholomaFort WorthOct 2018
    16
    2,731
    50
    Ho Chi Minh CityFort WorthOct 2018
    43
    10,520
    51
    CholomaFort WorthOct 2018
    19
    23,733
    52
    Phnom PenhFort WorthOct 2018
    47
    2,636
    53
    ManaguaFort WorthOct 2018
    14
    2,489
    54
    CholomaFort WorthOct 2018
    17
    23,918
    55
    CholomaFort WorthOct 2018
    16
    28,667
    56
    CholomaFort WorthOct 2018
    14
    2,821
    57
    CholomaFort WorthOct 2018
    14
    22,117
    58
    Ho Chi Minh CityFort WorthOct 2018
    36
    810
    59
    CholomaFort WorthOct 2018
    15
    22,198
    60
    Ho Chi Minh CityFort WorthOct 2018
    45
    3,437
    61
    CholomaFort WorthOct 2018
    13
    28,351
    62
    CholomaFort WorthOct 2018
    9
    5,935
    63
    CholomaFort WorthOct 2018
    14
    512
    64
    ManaguaFort WorthOct 2018
    13
    27,093
    65
    CholomaFort WorthOct 2018
    16
    23,352
    66
    CholomaFort WorthOct 2018
    16
    26,507
    67
    CholomaFort WorthOct 2018
    15
    30,803
    68
    CholomaFort WorthOct 2018
    14
    18,571
    69
    CholomaFort WorthOct 2018
    12
    17,950
    70
    CholomaFort WorthOct 2018
    15
    159
    71
    CholomaFort WorthOct 2018
    11
    28,491
    72
    CholomaFort WorthOct 2018
    12
    24,249
    73
    CholomaFort WorthOct 2018
    14
    9,727
    74
    CholomaFort WorthOct 2018
    12
    30,832
    75
    CholomaFort WorthOct 2018
    14
    22,494
    76
    Ho Chi Minh CityFort WorthOct 2018
    37
    11,835
    77
    CholomaFort WorthOct 2018
    13
    16,885
    78
    CholomaFort WorthOct 2018
    14
    605
    79
    Phnom PenhFort WorthOct 2018
    47
    2,595
    80
    ManaguaFort WorthOct 2018
    10
    30,722
    81
    ManaguaFort WorthOct 2018
    11
    27,680
    82
    Ho Chi Minh CityFort WorthOct 2018
    40
    995
    83
    84
    CholomaFort WorthOct 2018
    16.38
    90%
    85
    Ho Chi Minh CityFort WorthOct 2018
    44.77
    90%
    86
    ManaguaFort WorthOct 2018
    14.47
    90%
    87
    Phnom PenhFort WorthOct 2018
    46.87
    90%
    88
    89
    B84: =WgtPercentileIf(A$2:A$82, A84, B$2:B$82, C$2:C$82, C84)
    Last edited by shg; 11-14-2018 at 02:14 PM.

  17. #17
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    Code:

    Please Login or Register  to view this content.
    Last edited by shg; 11-14-2018 at 02:15 PM.

  18. #18
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    Re: weighted percentile

    My next stupid question, why do some of the lanes max out? Ex: Max percentile is 50.000%?

  19. #19
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    For example?

  20. #20
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    Re: weighted percentile

    Lane Time Wgt 90th%
    DamiettaFort WorthOct 2018 44 10648 Max percentile is 50.000%
    DamiettaFort WorthOct 2018 44 4020
    DamiettaFort WorthOct 2018 44 540

    DurangoFort WorthOct 2018 11 6479 Max percentile is 74.784%
    DurangoFort WorthOct 2018 3 6629
    DurangoFort WorthOct 2018 3 45
    DurangoFort WorthOct 2018 10 8337
    DurangoFort WorthOct 2018 12 6592

  21. #21
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    According to https://en.wikipedia.org/wiki/Percen...centile_method, when you have weighted percentiles, the percentile of a strata is

    p(n) = (x(n) - w(n)/2) / sum(w(i))

    In other words, it's the percentile of the midpoint of the strata. So for your second example

    M
    N
    O
    P
    Q
    R
    4
    Lane
    Value
    Wgt
    Cumu Wgt
    Pctile
    5
    DurangoFort WorthOct 2018
    3
    45
    45
    0.08%
    Q5: =(P5 - O5/2) / $P$9
    6
    DurangoFort WorthOct 2018
    3
    6,629
    6,674
    11.96%
    7
    DurangoFort WorthOct 2018
    10
    8,337
    15,011
    38.61%
    8
    DurangoFort WorthOct 2018
    11
    6,479
    21,490
    64.99%
    9
    DurangoFort WorthOct 2018
    12
    6,592
    28,082
    88.26%


    ..., all the transit times of 12 are at the 88.26 percentile.

    If you want the function to return 12 for any value >= 88.26 (and 3 for any value <=0.08), that's easy enough to do.

  22. #22
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    Let me ponder this a little more, Cynthia.

  23. #23
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    Re: weighted percentile

    Thank you!

  24. #24
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    I hadn't realized how little I know about percentiles. I think this is solid:

    A
    B
    C
    1
    Lane
    Time
    Pctile
    2
    CholomaFort WorthOct 2018
    13.00
    50%
    3
    Ho Chi Minh CityFort WorthOct 2018
    40.00
    50%
    4
    ManaguaFort WorthOct 2018
    11.00
    50%
    5
    Phnom PenhFort WorthOct 2018
    41.00
    50%
    6
    7
    B2: =WgtPctileIncIf(A$10:A$90, A2, B$10:B$90, C$10:C$90, C2)
    8
    9
    Lane
    Time
    Wgt
    10
    Ho Chi Minh CityFort WorthOct 2018
    37
    2,989
    11
    CholomaFort WorthOct 2018
    15
    7,784
    12
    CholomaFort WorthOct 2018
    17
    5,564
    13
    CholomaFort WorthOct 2018
    12
    29,663
    14
    CholomaFort WorthOct 2018
    12
    26,075
    15
    Ho Chi Minh CityFort WorthOct 2018
    43
    2,653
    16
    CholomaFort WorthOct 2018
    14
    2,565
    17
    CholomaFort WorthOct 2018
    8
    29,275
    18
    CholomaFort WorthOct 2018
    8
    27,639
    19
    CholomaFort WorthOct 2018
    15
    3,033
    20
    ManaguaFort WorthOct 2018
    14
    25,153
    21
    CholomaFort WorthOct 2018
    15
    25,042
    22
    CholomaFort WorthOct 2018
    14
    28,031
    23
    CholomaFort WorthOct 2018
    14
    1,502
    24
    ManaguaFort WorthOct 2018
    11
    24,382
    25
    CholomaFort WorthOct 2018
    11
    22,179
    26
    CholomaFort WorthOct 2018
    15
    188
    27
    CholomaFort WorthOct 2018
    14
    6,057
    28
    ManaguaFort WorthOct 2018
    14
    2,507
    29
    CholomaFort WorthOct 2018
    12
    28,879
    30
    CholomaFort WorthOct 2018
    17
    6,150
    31
    ManaguaFort WorthOct 2018
    2
    48
    32
    ManaguaFort WorthOct 2018
    14
    21,235
    33
    ManaguaFort WorthOct 2018
    15
    1,331
    34
    CholomaFort WorthOct 2018
    14
    3,111
    35
    CholomaFort WorthOct 2018
    16
    19,450
    36
    Ho Chi Minh CityFort WorthOct 2018
    44
    9,212
    37
    Ho Chi Minh CityFort WorthOct 2018
    47
    1,600
    38
    CholomaFort WorthOct 2018
    11
    25,631
    39
    CholomaFort WorthOct 2018
    11
    6,455
    40
    CholomaFort WorthOct 2018
    13
    23,756
    41
    Ho Chi Minh CityFort WorthOct 2018
    35
    3,153
    42
    CholomaFort WorthOct 2018
    9
    746
    43
    ManaguaFort WorthOct 2018
    15
    2,361
    44
    CholomaFort WorthOct 2018
    12
    28,903
    45
    CholomaFort WorthOct 2018
    11
    5,052
    46
    Ho Chi Minh CityFort WorthOct 2018
    35
    2,958
    47
    Ho Chi Minh CityFort WorthOct 2018
    37
    3,768
    48
    CholomaFort WorthOct 2018
    13
    13,417
    49
    CholomaFort WorthOct 2018
    8
    1,875
    50
    Ho Chi Minh CityFort WorthOct 2018
    47
    1,200
    51
    CholomaFort WorthOct 2018
    14
    26,892
    52
    CholomaFort WorthOct 2018
    12
    3,739
    53
    CholomaFort WorthOct 2018
    9
    18,997
    54
    Phnom PenhFort WorthOct 2018
    41
    24,128
    55
    Ho Chi Minh CityFort WorthOct 2018
    40
    3,958
    56
    Ho Chi Minh CityFort WorthOct 2018
    36
    940
    57
    CholomaFort WorthOct 2018
    16
    2,731
    58
    Ho Chi Minh CityFort WorthOct 2018
    43
    10,520
    59
    CholomaFort WorthOct 2018
    19
    23,733
    60
    Phnom PenhFort WorthOct 2018
    47
    2,636
    61
    ManaguaFort WorthOct 2018
    14
    2,489
    62
    CholomaFort WorthOct 2018
    17
    23,918
    63
    CholomaFort WorthOct 2018
    16
    28,667
    64
    CholomaFort WorthOct 2018
    14
    2,821
    65
    CholomaFort WorthOct 2018
    14
    22,117
    66
    Ho Chi Minh CityFort WorthOct 2018
    36
    810
    67
    CholomaFort WorthOct 2018
    15
    22,198
    68
    Ho Chi Minh CityFort WorthOct 2018
    45
    3,437
    69
    CholomaFort WorthOct 2018
    13
    28,351
    70
    CholomaFort WorthOct 2018
    9
    5,935
    71
    CholomaFort WorthOct 2018
    14
    512
    72
    ManaguaFort WorthOct 2018
    13
    27,093
    73
    CholomaFort WorthOct 2018
    16
    23,352
    74
    CholomaFort WorthOct 2018
    16
    26,507
    75
    CholomaFort WorthOct 2018
    15
    30,803
    76
    CholomaFort WorthOct 2018
    14
    18,571
    77
    CholomaFort WorthOct 2018
    12
    17,950
    78
    CholomaFort WorthOct 2018
    15
    159
    79
    CholomaFort WorthOct 2018
    11
    28,491
    80
    CholomaFort WorthOct 2018
    12
    24,249
    81
    CholomaFort WorthOct 2018
    14
    9,727
    82
    CholomaFort WorthOct 2018
    12
    30,832
    83
    CholomaFort WorthOct 2018
    14
    22,494
    84
    Ho Chi Minh CityFort WorthOct 2018
    37
    11,835
    85
    CholomaFort WorthOct 2018
    13
    16,885
    86
    CholomaFort WorthOct 2018
    14
    605
    87
    Phnom PenhFort WorthOct 2018
    47
    2,595
    88
    ManaguaFort WorthOct 2018
    10
    30,722
    89
    ManaguaFort WorthOct 2018
    11
    27,680
    90
    Ho Chi Minh CityFort WorthOct 2018
    40
    995


    Code follows.

  25. #25
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    Please Login or Register  to view this content.
    Last edited by shg; 11-15-2018 at 12:32 PM.

  26. #26
    Registered User
    Join Date
    11-05-2018
    Location
    United States
    MS-Off Ver
    2016
    Posts
    8

    Re: weighted percentile

    It works perfectly and processed 5k lines in no time. Thank you so much for all the help!

  27. #27
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: weighted percentile

    Glad it worked for you, you're welcome.

  28. #28
    Registered User
    Join Date
    07-29-2019
    Location
    Los Angeles. Ca
    MS-Off Ver
    2013
    Posts
    38

    Re: weighted percentile

    Hi All - I have a similar question. I have data with similar questions. The data set is a sample of set, Origin, Destination, Number of Units, Conveyance mode rail or truck, transit days. I am looking for a weighted average and ranked by 90% percentile? How do i best sort to get the weighted average and 90 percentile for each lane based on transit days. Here is a sample. There are some negative values that will eventually be corrected. I have tried to upload a file but file upload states failed?
    Last edited by Kimber154; 07-29-2019 at 05:28 PM.

  29. #29
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,898

    Re: weighted percentile

    Administrative Note:

    Welcome to the 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
    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.

  30. #30
    Registered User
    Join Date
    07-29-2019
    Location
    Los Angeles. Ca
    MS-Off Ver
    2013
    Posts
    38

    Talking Re: weighted percentile

    Hi AliGW,
    I am sorry, I am new to the forum! How do I post a new thread?
    Thank you!

  31. #31
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,898

    Re: weighted percentile

    Go here and click on the big blue button: https://www.excelforum.com/excel-for...and-functions/

  32. #32
    Registered User
    Join Date
    11-19-2014
    Location
    Mumbai, Maharashtra, INDIA
    MS-Off Ver
    2003
    Posts
    52

    Re: weighted percentile

    @shg;

    I had a question (and observation) regarding post 11.

    - Why are we limiting the percentiles by bounding between Min. and Max.? As the UDF is using Interpolation Scheme, there will always be a percentile. For, eg. Row 87, Phnom PenhFort WorthOct 2018 why does the UDF output Maximum percentile is 91.091% for p=0.95?

    - If I use the array formula =PERCENTILE(IF(COLUMN(INDIRECT("1:"&MAX(C80:C82)))<C80:C82,B80:B82,""),0.95) I get 47 as the output [This array formula uses the Nearest Rank Scheme instead of Interpolation Scheme; Using Interpolation Scheme one should get an calculated value.

  33. #33
    Registered User
    Join Date
    11-19-2014
    Location
    Mumbai, Maharashtra, INDIA
    MS-Off Ver
    2003
    Posts
    52

    Re: weighted percentile

    @shg;

    I got the first part. I had missed a code.

  34. #34
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: weighted percentile

    Administrative Note:

    Welcome to the 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

  35. #35
    Registered User
    Join Date
    11-19-2014
    Location
    Mumbai, Maharashtra, INDIA
    MS-Off Ver
    2003
    Posts
    52

    Re: weighted percentile

    @Pepe Le Mokko;

    I am not starting a new discussion here. My query is on the existing code and method in question. Dont want re-invent the wheel is a new post. Does that sound fair?

  36. #36
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: weighted percentile

    Please start a new thread adding a link to this one.
    I will close this post to avoid any further hi-jacking

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Weighted Percentile Calculation Help
    By g3diamondback in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-08-2023, 01:47 PM
  2. Weighted Average Function for Series Weighted by Increments of 1
    By kratsexcel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-05-2018, 11:38 AM
  3. Replies: 1
    Last Post: 02-28-2018, 02:38 AM
  4. Replies: 0
    Last Post: 02-15-2018, 03:04 AM
  5. Custom Function for Weighted Percentile
    By Agferna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2014, 02:54 PM
  6. [SOLVED] Conditional percentile: Bug in percentíle function?
    By Duronka in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-13-2013, 08:08 AM
  7. [SOLVED] PERCENTILE.INC and PERCENTILE.EXC - difference
    By Saturn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-19-2012, 11:34 AM

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