Greetings,
I am adding integer values to a collection. After adding all the values meeting the add criteria I would like to take the average value of the integer and output it to a sheet.
I am unsure of how to calculate the mean value of the contents in a collection.
Would this be easier to do with an array?
I am adding integer values to a collection. After adding all the values meeting the add criteria I would like to take the average value of the integer and output it to a sheet.
I am unsure of how to calculate the mean value of the contents in a collection.
Would this be easier to do with an array?
Code:
Dim a As IntegerDim b As Integer
Dim NCL As Integer
Dim NRL As Integer
Rng1 As Range
Rng2 As Range
LastRow As Integer
coll As New Collection
With ActiveWorkbooks.ActiveSheet
Rng1 = .Range("BY11", "CR11")
Rng2 = .Range("BX12", "BX21")
For Each a In Rng1
NCL = a
For Each b In Rng2
NRL = b
LastRow = Cells(Rows.Count, "BE").End(xlUp).Row
For i = 2 To LastRow
If Cells(i, "BS") < Abs(NCL) And Cells(i, "BV") > NRL Then
coll.Add Cells(i, "BT").value
Next i
'#################I would like to define a variable as the average value of the items included in the collection here