Make Your Microsoft Dynamics Investment Count & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.
Become a Premium Member and unlock a new, free course in leading technologies each month.
sub Hist3UK(M As Long, arr() As Double)
Dim i As Long, j As Long
Dim Length As Single
ReDim breaks(M) As Single
ReDim freq(M) As Single
For i = 1 To M
freq(i) = 0
Next i
Length = (arr(UBound(arr)) - arr(1)) / M
For i = 1 To M
breaks(i) = arr(1) + Length * i
Next i
For i = 1 To UBound(arr)
If (arr(i) <= breaks(1)) Then freq(1) = freq(1) + 1
If (arr(i) >= breaks(M - 1)) Then freq(M) = freq(M) + 1
For j = 2 To M - 1
If (arr(i) > breaks(j - 1) And arr(i) <= breaks(j)) Then freq(j) = freq(j) + 1
Next j
Next i
For i = 1 To M
Sheet3.Cells(i + 9, 10) = breaks(i)
Sheet3.Cells(i + 9, 11) = freq(i)
Next i
End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Private Sub test()
Dim arr() As Double
Dim t As Long
Dim cell As Range
Dim i As Integer
t = 4 'number of categories
ReDim arr(1 To 8) 'number of data points... if you have 8 points 1 to 8. if you have more, replace the 8 with number of points
i = 1
For Each cell In Range("THERANGE") 'name a range on the worksheet which has all the data points, SORTED from low to high
arr(i) = cell.Value
i = i + 1
Next
Hist3UK t, arr
End Sub
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.