Standard Deviation with a macro tool

A

Aidan Murphy

how do i write a macro tool for standard deviation and standard error
that have a different number of data points each time i run the macro

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
B

BrianB

These macros produce numbers - whether they are the right onesor not
haven't a clue <<grin>>.


STANDARD DEVIATION (Worksheet Function STDEV)
Select your (maximum 30) numbers and run this macro :-
'----------------------------------
Sub Standard_Deviation()
'- maximum 30 numbers Excel limit
STD = Application.WorksheetFunction.StDev(Selection)
MsgBox (STD)
End Sub
'=======================================
STANDARD ERROR (worksheet function STEYX)
Assumes you have selected 2 equal length columns of numbers.
'----------------------------------
Option Base 1
Sub Standard_Error()
Dim MyArray1() ' dependant points 1st.column
Dim MyArray2() ' independant points 2nd. column
Dim RowCount As Long
'--------------------
RowCount = Selection.Rows.Count
ReDim MyArray1(RowCount)
ReDim MyArray2(RowCount)
'-----------------------------
For c = 1 To RowCount
MyArray1(c) = Selection.Cells(c, 1).Value
MyArray2(c) = Selection.Cells(c, 2).Value
Next
SE = Application.WorksheetFunction.StEyx(MyArray1, MyArray2)
MsgBox (SE)
End Sub
'------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top