Dim avg1 As Range
Dim avg2 As Range
Dim SumNumerator As Range
Dim SumDenominator1 As Range
Dim SumDenominator2 As Range
Dim Correl As Double
For i = 0 To 23 'hours
For j = 0 To 59 'minutes
If rec1secdata(0, i, j, 0).blnValid = True Then 'Valid minute
With rec1minData(i, j)
For col_cnt = 12 To 13 'on each 1 second data column
col_cnt1 = 88
For k = 0 To 59 'seconds
'get 60 second average for both wind speed readings
'60 second sum for wind speed 1
avg1 = _
avg1 + rec1secdata(0, i, j, k).sngCol(12)
'60 second average for wind speed 1
avg1 = avg1 / 60
'60 second sum for wind speed 2
avg2 = _
avg2 + rec1secdata(0, i, j, k).sngCol(13)
'60 second average for wind speed 1
avg2 = avg2 / 60
'Get the value for the numerator of the correlation coefficient equation
SumNumerator = SumNumerator + _
((rec1secdata(0, i, j, k).sngCol(12) - avg1) * _
(rec1secdata(0, i, j, k).sngCol(13) - avg2))
'Get the value for the first half of the denominator of the correlation coefficient equation
SumDenominator1 = SumDenominator1 + _
(rec1secdata(0, i, j, k).sngCol(12) - avg1) ^ 2
'Get the value for the second half of the denominator of the correlation coefficient equation
SumDenominator2 = SumDenominator2 + _
(rec1secdata(0, i, j, k).sngCol(13) - avg2) ^ 2
'Getiing the correlation coefficient for each 60 second data period
Correl = SumNumerator / Sqr((SumDenominator1 ^ 2) * _
(SumDenominator2 ^ 2))
Next
Next 'Col_cnt
End With
End If
Next 'Min
Next 'hour