Calculating percentiles on subset of data

ExcelQ12

New Member
Joined
Dec 3, 2019
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am hoping someone here will have a creative solution to my problem. I am novice at vba and dynamic ranges always mess me up. I have a set of data, lets say 1000 rows. I want to do percentiles on this data. However it gets a bit more complicated. Of the 1000 rows I have the data broken out in chunks of varying length. For example chunk 1 could be row 1 to 100, chunk 2 is row 101 to 144. Chunk 3 is row 145 to 207. Etc. I want to percentile each of these chunks.

I know the formula to calculate the percentile is =percentile.exc(range, 0.1), then =percentile.exc(range, 0.2), etc until 0.9.

For example on the below data, I want to percentile on the $ column but broken up by set. So my first set of percentiles would be =percentile.exc(C$2$:C$5$, 0.1) and my second set of percentiles would be =percentile.exc(C$6$:C$10$, 0.1). Is there a vba way to determine the data ranges?

ItemSet$
11100
21150
31250
41300
524
6275
7284
82200
92500
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I changed my mind. Please try these formulas:

The percentile formula uses values from the table to reference the correct part of the table. You will definitely have to have your original table sorted by SET or it won't work. The formula starting in cell G2 uses a dynamic range based on the values in row 1 above.

Book1
ABCDEFGHIJK
1ItemSet$Rank12345
2111000.111532.4#N/A6.2#N/A
3211500.213060.8#N/A7.4#N/A
4312500.314576.8#N/A8.6#N/A
5413000.417080.4#N/A9.8#N/A
65240.520084#N/A11#N/A
762750.6230130.4#N/A15.4#N/A
872840.7255176.8#N/A19.8#N/A
9822000.8270260#N/A24.2#N/A
10925000.9285380#N/A28.6#N/A
1110451300500#N/A33#N/A
1211411
1312433
Sheet3
Cell Formulas
RangeFormula
G2:K11G2=PERCENTILE(OFFSET(Sheet3!$C$1,MATCH(G$1,Sheet3!$B:$B,0)-1,0,MATCH(G$1,Sheet3!$B:$B)-MATCH(G$1,Sheet3!$B:$B,0)+1,1),$F2)
 
Upvote 0
Hi Jeff,

Thanks for getting back to me. I ended up going another route as I did not see this reply in time. Thank you for your effort though and I have saved this thread, as I imagine I will come to this issue again.
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,247
Members
448,879
Latest member
oksanana

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