Hello everyone. I got stuck again. Did a quick search and couldn't find anything on this so here it is.
I am trying to get the median of a series of numbers.
In column 3, row 49 i start a list of daily flows. I am trying to calculate a medain flow for the month, this means my range is 31 days the first month, then 29 (leap year) then 31 etc. I would like the medain values for each month to be displayed in column 4, starting in row 49.
Here is the code I have so far.
the integer d is the number of days each month and they are located in column 12, row 1 - 36 (i have 3 years of data).
I am stuck on the activecell.formula line. Cany anyone help here?
Thanks again
hayden
I am trying to get the median of a series of numbers.
In column 3, row 49 i start a list of daily flows. I am trying to calculate a medain flow for the month, this means my range is 31 days the first month, then 29 (leap year) then 31 etc. I would like the medain values for each month to be displayed in column 4, starting in row 49.
Here is the code I have so far.
Code:
Sub monthlymedian()
Dim d As Integer
For i = 1 To 36
d = Cells(i, 12).Value
Cells(i + 48, 5).Select
ActiveCell.FormulaR1C1 = "=MEDIAN(RC[-2]:R[" & d - 1 & "]C[-2])"
' Worksheet.Function.Median (Range("d" & j & ":d" & j + d - 1))
Next
End Sub
the integer d is the number of days each month and they are located in column 12, row 1 - 36 (i have 3 years of data).
I am stuck on the activecell.formula line. Cany anyone help here?
Thanks again
hayden