Dynamic Formula

lmejias

New Member
Joined
May 27, 2015
Messages
1
I have a data set with a dynamic range and can write a formula to fill down. but o would like the r1c1 callouts to use a dynamic range instead of a preset. Help please!!

here is my current formula (10 columns of data)

normally I would:

Dim endRow As Long
endRow = Cells(Rows.Count, "A").End(xlUp).Row

'set formula
Range("A1").End(xlToRight).Offset(1, -2).FormulaR1C1 = _
"=IF(OR(MEDIAN(RC[-10]:RC[-1])*1.05<RC[1],MEDIAN(RC[-10]:RC[-1])*0.95>RC[1]),""Check for Potential Outliers - "" & COUNTIF(RC[-10]:RC[-1],"">""&1.05*MEDIAN(RC[-10]:RC[-1]))+COUNTIF(RC[-10]:RC[-1],""<""&0.95*MEDIAN(RC[-10]:RC[-1]))-COUNTIF(RC[-10]:RC[-1], ""=0""),"""")"

'then fill down
Range("x").AutoFill Destination:=Range("x2:x" & endRow)


but what if I have 5 or 50? how do I change RC[-10]:RC[-1] to value#1 to last value in a row and then fill formula down a column to last row.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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