Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have adapted an algorithm for calculating the standard deviation of
levels (20Log(x)) in an Excel function. The function seems to work correctly but when I reopen the workbook or even open a chart with the SD values the workbook fails to recalculate sometimes. I use XL97. The code is provided below. Does anyone have any suggestions? ' This function calculates the positive 2 standard deviation for a collection of ranges ' Created 6/22/04 ' By: Dave Murphy ' Function SDPDB(ParamArray Levels()) As Variant Application.Volatile Dim rng As Variant, S As Double, A As Double, Sig As Double Dim SigPdB As Double, SigMdB As Double, x As Variant, n As Integer, LA As Double A = 0 S = 0 n = 0 For Each rng In Levels() For Each x In Range(rng.Address) If Not IsEmpty(x) Then A = A + 10 ^ (x / 20) S = S + 10 ^ (x / 10) n = n + 1 End If Next x Next rng A = A / n LA = 20 * Application.WorksheetFunction.Log10(A) Sig = 1 / (n - 1) ^ 0.5 * (S - n * 10 ^ (LA / 10)) ^ 0.5 SDPDB = 20 * Application.WorksheetFunction.Log10(1 + 2 * Sig / A) End Function Thanks for any help, Dave |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Standard deviation calculation error... | Excel Discussion (Misc queries) | |||
Which function to determine 1 and 2 standard deviation? | Excel Worksheet Functions | |||
Standard deviation calculation | Excel Worksheet Functions | |||
calculation of standard deviation is not as help document says | Excel Discussion (Misc queries) | |||
Is there a standard deviation calculation in Excel? | Excel Worksheet Functions |