Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
jdeumer
 
Posts: n/a
Default Sorting into quintiles


L.S.,

For my thesis I need to sort stocks into quintiles and calculate the
average per quintile. I am using the "LARGE" function to do this.
However, the number of available stocks differs per month, so that the
value for "k" (in this case a range) needs to be adapted every time.
Furthermore, the value for k needs to be rounded up for the first four
quintiles, the last quintile consists of the remaining number of
stocks.

Currently I am using this formula to calculate the average of stocks
that need to be sorted into quintiles, for the first quintile:

{=AVERAGE(LARGE($B14:$FT14,ROW(INDIRECT("1:"&ROUND UP(FV14/5,0)))))}

where
$B14:$FT14 = the range with all available stocks and
Cell FV14 contains the total number of stocks available for this
specific month.
ROW(INDIRECT("1:"&ROUNDUP(FV14/5,0))) indicated the range for 'k'.

This seems to work (I checked). For the second quintile however I want
the formula to do this: start from ROUNDUP(FV14/5,0) + 1 until 2 *
ROUNDUP(FV14/5,0). Intuitively, this would look like this, but does not
work:

{=AVERAGE(LARGE($B14:$FT14,ROW(INDIRECT("ROUNDUP(F V14/5+1,0):"&(2*ROUNDUP(FV14/5,0))))))}


I find it hard to fully understand the INDIRECT function, which might
explain my difficulty creating this formula.

Thanks for your help!

RJE Deumer


--
jdeumer
------------------------------------------------------------------------
jdeumer's Profile: http://www.excelforum.com/member.php...o&userid=25181
View this thread: http://www.excelforum.com/showthread...hreadid=386710

  #2   Report Post  
ScottO
 
Posts: n/a
Default

I think a found a way ...
If your data is in the range called "Range" and you enter into Cells G3 to
G7 the ascending values 0.2 to 1.0 (formatted to % if you want)
Then in H3 put the Array formula
{=AVERAGE(IF(Range<=CEILING(PERCENTILE(Range,G3),1 ),Range))} (do CSE)

Then in H4 put the regular formula
=SUMPRODUCT(--(Range<=CEILING(PERCENTILE(Range,G4),1)),--(RangeCEILING(PERC
ENTILE(Range,G3),1)),Range)/SUMPRODUCT(--(Range<=CEILING(PERCENTILE(Range,G4
),1)),--(RangeCEILING(PERCENTILE(Range,G3),1)),Range/Range)

Then drag the H4 formula down to H7.

Unless I've missed something, that should do it.

Rgds,
ScottO


"jdeumer" wrote in
message ...
|
| L.S.,
|
| For my thesis I need to sort stocks into quintiles and calculate the
| average per quintile. I am using the "LARGE" function to do this.
| However, the number of available stocks differs per month, so that the
| value for "k" (in this case a range) needs to be adapted every time.
| Furthermore, the value for k needs to be rounded up for the first four
| quintiles, the last quintile consists of the remaining number of
| stocks.
|
| Currently I am using this formula to calculate the average of stocks
| that need to be sorted into quintiles, for the first quintile:
|
| {=AVERAGE(LARGE($B14:$FT14,ROW(INDIRECT("1:"&ROUND UP(FV14/5,0)))))}
|
| where
| $B14:$FT14 = the range with all available stocks and
| Cell FV14 contains the total number of stocks available for this
| specific month.
| ROW(INDIRECT("1:"&ROUNDUP(FV14/5,0))) indicated the range for 'k'.
|
| This seems to work (I checked). For the second quintile however I want
| the formula to do this: start from ROUNDUP(FV14/5,0) + 1 until 2 *
| ROUNDUP(FV14/5,0). Intuitively, this would look like this, but does not
| work:
|
|
{=AVERAGE(LARGE($B14:$FT14,ROW(INDIRECT("ROUNDUP(F V14/5+1,0):"&(2*ROUNDUP(FV
14/5,0))))))}
|
|
| I find it hard to fully understand the INDIRECT function, which might
| explain my difficulty creating this formula.
|
| Thanks for your help!
|
| RJE Deumer
|
|
| --
| jdeumer
| ------------------------------------------------------------------------
| jdeumer's Profile:
http://www.excelforum.com/member.php...o&userid=25181
| View this thread: http://www.excelforum.com/showthread...hreadid=386710
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Sorting 1, 1A, 2, 2A, 3, 4, 4A, 4B . . . agc1234 Excel Discussion (Misc queries) 6 May 26th 05 08:02 PM
sorting number in ascending order Janice Lee via OfficeKB.com Excel Discussion (Misc queries) 2 April 8th 05 10:31 PM
Adding a KeyID column for sorting Rebecca New Users to Excel 3 February 20th 05 07:09 PM
sorting question Brian Excel Discussion (Misc queries) 4 November 28th 04 12:30 PM


All times are GMT +1. The time now is 05:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"