PDA

View Full Version : VBA Excel Basic Desciptive Statistics



tommylam422
11-11-2010, 01:40 PM
I have some data on my work sheet one on PS04.xls. With the given dataset and i want to compute the max, min, mean, standard deviation and variance for each time series.

I cannot use any built-in Excel function in this question, and also i have to determine the median of the each time series.
Please Help:banghead:

tommylam422
11-11-2010, 01:41 PM
What i got so far :

Sub Question_5a()
'Declare Variables
Dim pR As Range 'set range
Dim pC As Range 'set counter
Dim Max As Double 'Cell
Dim i As Integer

Worksheets("DescStats").Activate
Set pC = Range("B2", Range("B2").End(xlDown))
Max = pC(1)
For i = 2 To pC.Count
If Max < pC(i) Then
Max = pC(i)
Else
Max = Max
End If
Next i
MsgBox (Max)
End Sub