How to get the percentile value of a dynamic range?

dEX2018

New Member
Joined
Aug 7, 2013
Messages
8
Hello

I'm struggling to write the correct formula to get the 90th percentile of a dynamic range. I don't want to do it in VBA as it seems to be possible with an Excel formula.

I've found this post but I don't manage to amend the formula properly: http://www.mrexcel.com/forum/excel-questions/712238-how-get-percentile-value-over-dynamic-range.html

Below is a sample of my data set (sorted on column A). I would to have the 90th percentile of B2:B6 (so for 20400) and the 90th percentile of B7:B10 (for 23500). But the formula should dynamically take the correct range, as longs as value in column A matches '20400', '23500', ...

[TABLE="width: 250"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD][/TD]
[TD]90th percentile[/TD]
[/TR]
[TR]
[TD]20400[/TD]
[TD]5,756[/TD]
[TD]20400[/TD]
[TD][/TD] [/TR] [TR] [TD]20400[/TD] [TD]15,326[/TD] [TD]23500[/TD] [TD][formula][/TD] [/TR] [TR] [TD]20400[/TD] [TD]524,365[/TD] [TD][/TD] [TD][/TD] [/TR] [TR] [TD]20400[/TD] [TD]2,750,365[/TD] [TD][/TD] [TD][/TD] [/TR] [TR] [TD]20400[/TD] [TD]956,324[/TD] [TD][/TD] [TD][/TD] [/TR] [TR] [TD]23500[/TD] [TD]75,653[/TD] [TD][/TD] [TD][/TD] [/TR] [TR] [TD]23500[/TD] [TD]654,365[/TD] [TD][/TD] [TD][/TD] [/TR] [TR] [TD]23500[/TD] [TD]15,236[/TD] [TD][/TD] [TD][/TD] [/TR] [TR] [TD]23500[/TD] [TD]236,543[/TD] [TD][/TD] [TD][/TD] [/TR] </tbody>[/TABLE] Many thanks for your help!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Assume "20400" in cell C2
In D2 Paste this :
=PERCENTILE.INC(LARGE(IF($A$2:$A$10=C2,$B$2:$B$10,0),ROW(INDIRECT(1&":"&COUNTIF($A$2:$A$10,C2)))),0.9)

Ctrl Shift Enter
 
Upvote 0
Thanks but isn't there an easier way? Can't I combine the Match with the Percentile function?

Something like this (the formula gives an error so I'm trying now to make it work):

In Cell D2 (for 20400):
Code:
=PERCENTILE(B2:B & MATCH(C2,A:A,1),0.9)
In Cell E2 (for 23500):
Code:
=PERCENTILE(B2:B & MATCH(C3,A:A,1),0.9)

where Match calculates the end of the range.
 
Upvote 0
I don't think your formula going to work
As you can see the range for calculates for 23500 are from B7:B10 , not B2
And may be just me, but i can't come up with a way to make MATCH return end of the range.
 
Upvote 0
You could use

=PERCENTILE.INC(IF(A:A=C1,B:B),0.9)

Seems to be quick even using the full column references.
 
Upvote 0
I don't think your formula going to work
As you can see the range for calculates for 23500 are from B7:B10 , not B2
And may be just me, but i can't come up with a way to make MATCH return end of the range.

This works for numerical data.

=MATCH(9.999999E+307,A:A,1)
 
Upvote 0
I don't think your formula going to work
As you can see the range for calculates for 23500 are from B7:B10 , not B2
And may be just me, but i can't come up with a way to make MATCH return end of the range.

Enter
Code:
=MATCH(C2,A:A,0)
to retrieve beginning row of range (2 in my example) and
Code:
=MATCH(C2,A:A,1)
to retrieve end of range (6) .
 
Upvote 0
You could use

=PERCENTILE.INC(IF(A:A=C1,B:B),0.9)

Seems to be quick even using the full column references.

Steve, this gives the same result for 20400 & 23500 because if true the array to calculate the percentile is always the full column B, not a variable range.

Below formula gives #VALUE error:

Code:
=PERCENTILE(IF(A:A=C3,"B" & MATCH(A2,A:A,0) & ":B" & MATCH(A2,A:A,1)),0.9)

I'm really looking for a combination of PERCENTILE and MATCH but no luck so far ...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top