Easy Range question

hayden

Board Regular
Joined
Sep 23, 2005
Messages
188
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.

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
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Request for some clarifications
Assume i=1
and
d=30
then
I think according to your code, the activecell is E49
Then what is the range for which median is required in A1 styl.e?
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top