There are definitely easier ways to achieve what this code is trying to do, but I created a simplified code to show what I am trying to achieve. Basically I want to perform calculations on lots of data and I don't want to have to have to add that to the worksheets.
So basically I need to run formulas like sum, averageifs, etc. in a worksheet through using an Array that I defined in my Macro. At this point I can't figure out how to turn this array, containing 5 values, into a "=sum( )" function. Thanks in advance for your help!
Sub ArraySum()
Dim numbers(5) As Double
Dim E As Double
For I = 1 To 5
E = Cells(I, 1)
numbers(I) = Cos(E)
Next I
Range("b1").Formula = "=sum(" & numbers & ")"
End Sub