LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Loss Deviation

I don't have that much VBA experience so have a simple
question. I am trying to set up a user-defined function
to simplify a two-part calculation to calculate "loss
deviation", which is similar to standard deviation (of a
set of investment returns) except that it throws out all
positive values (and therefore calculates standard
deviation of all the losses only).

So the first part of my function needs to look at all of
the values in a range and then isolate the losses to
create a new range (this is what I can't figure out how
to do). Then, the second part of my new function can
calculate a standard deviation based on that new range.

Mathematically:

Where N = Number of Periods

Where Ri = Return for period I

Where Ml = Loss Mean

Where Li = Ri ( IF Ri < 0 )or 0 ( IF Ri = 0 )

Where LLi = Ri - Ml ( IF Ri < 0 ) or 0 ( IF Ri =
0 )

Nl = Number of periods that Ri < 0

Ml = (Sum for 1...I of Li) / Nl

Loss Deviation = sqrt( Sum for 1...I ( LLi)^2 / (Nl -
1))

I can do this in excel by laying out a second column
which refers to each cell in the first column and makes
all the positive values 0 using the Min function. But I
don't know how to automate this using VBA. Many thanks
for the help with this.

 
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
Standard Deviation Soccerboy83 Excel Discussion (Misc queries) 2 June 16th 09 01:27 AM
hardship letter explaining devastating loss property loss financi carol Excel Discussion (Misc queries) 1 June 12th 09 02:13 PM
Standard deviation Svi Excel Discussion (Misc queries) 5 October 15th 07 10:13 AM
Weight loss line chart to monitor weight loss progress S Fox Charts and Charting in Excel 6 November 8th 05 05:10 PM
Standart deviation ? Loic Charts and Charting in Excel 1 August 23rd 05 11:49 PM


All times are GMT +1. The time now is 03:24 PM.

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

About Us

"It's about Microsoft Excel"