View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
davidm davidm is offline
external usenet poster
 
Posts: 1
Default Square Root in VBA


Lucy,

It appears to me that your problem is more about finding the standard
deviation via the variance. If that is the case, read on.

Depending on what you are doing, it is possible to derive the standard
deviation from the variance using a matrix and row construct with MMULT
and the TRANSPOSE function.

But to get your FUNCTION to work, first re-write it thus:

Function test1( RegionR, CovarMatrix) As Variant
test1 =
Application.MMult(Application.MMult(RegionR, CovarMatrix),
Application.Transpose(RegionR))
End Function

where, *RegionR * is a Row range and *CovarMatrix* is a Square matrix
range. Then, supposing RegionR="A1:A3" and CovarMatrix = "E1:J6", the
following *entered as an ARRAY* will return the variance (the *square
root* of which yields the standard deviation)


=Test1(A1:A3,E1:J6) Control+Shift+Enter


As hinted by earlier posts, the SQR function will simply convert the
variance to standard deviation.


HTH,

David


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=483954