Median & Percentile for the range of various lengths

trader1011

New Member
Joined
Sep 24, 2013
Messages
7
Hi,

I am trying to calculate the Median & 75th Percentile for the range in array where the range differs in the length. For example, my data looks like the one given below (my data-set is almost 100,000 rows). Now I am trying to find the median and 75th percentile values of a combined set of 3 batches where every next batch will drop the first member and and the next member (Set 1 - Batch no. 1, 2,3 & Set 2 - Batch no. 2, 3, 4 etc.). I have provided the result in the table no. 2.

As one can see from the data-set the length of range (no. of data points for each batch) is varying.

Any help will be appreciated.

Table 1: Data-set

Batch #Value
11
112
110
15
23
223
26
32
35
478
42
43
41
45
54
59
61
63
611
715

<tbody>
</tbody>

Table 2: Result

Set (Batch no.)Median75th Percentile
1-3511
2-4410.25
3-547
4-63.59.5
5-76.512

<tbody>
</tbody>
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Perhaps:

ABCDEFG
1Batch #ValueSet: Low BatchSet: High BatchMedian75th Percentile
21113511
311224410.25
41103547
515463.59.5
623576.512
7223#N/A#N/A
826
932
1035
11478
1242
1343
1441
1545
1654
1759
1861
1963
20611
21715

<tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
E2=D2+2
F2=MEDIAN(INDEX(B:B,MATCH(D2,A:A,0)):INDEX(B:B,LOOKUP(2,1/(A$2:A$21=E2),ROW(A$2:A$21))))
G2=PERCENTILE.EXC(INDEX(B:B,MATCH(D2,A:A,0)):INDEX(B:B,LOOKUP(2,1/(A$2:A$21=E2),ROW(A$2:A$21))),0.75)

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Amazing Eric. Thanks for the help. It worked quite well. I am going to try to understand the logic you have used in the formula though.
 
Upvote 0
Glad to help! :cool:

To help you out, this part of the formula:

MATCH(D2,A:A,0)

finds the first instance of D2 in column A, and this part:

LOOKUP(2,1/(A$2:A$21=E2),ROW(A$2:A$21))

finds the last instance of E2 in A2:A21.
 
Upvote 0

Forum statistics

Threads
1,215,049
Messages
6,122,864
Members
449,097
Latest member
dbomb1414

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