Hi Everyone.
I am a novice and this is my first post, but this site has solved many issue for me in the past. Anyway, onto my issue.
I have a data file with 3 sections, and I'm doing calculations on the middle section. For the data that I want counted, I've been using code like this:
because the number of rows in the middle section is variable. That works great, but now I have a more complicated calculation; namely, an AVERAGEIF array formula. If I record a macro of the formula it of course uses the R1C1 notation.
I assume that there is a way to use the Ranges as I have in the first example, but I'm getting lost in the syntax. Any assistance would be greatly appreciated.
Thanks,
Hank
P.S. I'm running Excel 2010 and Windows 7
I am a novice and this is my first post, but this site has solved many issue for me in the past. Anyway, onto my issue.
I have a data file with 3 sections, and I'm doing calculations on the middle section. For the data that I want counted, I've been using code like this:
Code:
With Range("S170").End(xlDown).Offset(3, 0)
.Value = Application.WorksheetFunction.CountIf(Range("S170", Range("S170").End(xlDown)), "Y")
End With
because the number of rows in the middle section is variable. That works great, but now I have a more complicated calculation; namely, an AVERAGEIF array formula. If I record a macro of the formula it of course uses the R1C1 notation.
Code:
Selection.FormulaArray = _
"=AVERAGE(IF((R[4]C[-4]:R[19]C[-4]>0),R[4]C[-4]:R[19]C[-4]))"
I assume that there is a way to use the Ranges as I have in the first example, but I'm getting lost in the syntax. Any assistance would be greatly appreciated.
Thanks,
Hank
P.S. I'm running Excel 2010 and Windows 7