FormulaR1C1

lezhi

New Member
Joined
Aug 18, 2011
Messages
12
I was trying to use formulaR1C1 function calculate as below:

MyCount = Application.Count(Range("A:A")) + 4
ActiveCell.FormulaR1C1 = _
"=IF(AND(R[2]C=""Adj Close"", R[MyCount]C<?XML:NAMESPACE PREFIX = MIN(R[3]C /><MIN(R[3]C:R[MyCount R[MyCount]C Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), ->MAX(R[3]C:R[MyCount - 1]C)), ""buy"", """"))"

It gave error of "Application defined or object defined error" when I put "MyCount" instead of numbers into the brackets after "R". Does that mean, only numbers are accepted in this FormulaR1C1 function? Is there any other method can help me to do the calculation?

Thank you,

Rachel
</MIN(R[3]C:R[MyCount>
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Welcome to the board.

This would work ...

Code:
... = "=IF(AND(R[2]C=""Adj Close"", R[" & MyCount & "]C<?XML:NAMESPACE PREFIX = MIN(R[3]C /><MIN(R[3]C:R[MyCount - 1]C)), ??sell??, IF(AND(R[2]C="" Adj Close??, R[MyCount]C>MAX(R[3]C:R[" & MyCount & " - 1]C)), ""buy"", """"))"</MIN(R[3]C:R[MyCount>

<MIN(R[3]C:R[MyCount - 1]C)), ??sell??, IF(AND(R[2]C="" Adj Close??, R[MyCount]C></MIN(R[3]C:R[MyCount>
<MIN(R[3]C:R[MyCount - 1]C)), ??sell??, IF(AND(R[2]C="" Adj Close??, R[MyCount]C>... but for CMAX; what is that?


</MIN(R[3]C:R[MyCount>
 
Upvote 0
Welcome to the board.

This would work ...

Code:
... = "=IF(AND(R[2]C=""Adj Close"", R[" & MyCount & "]C<?XML:NAMESPACE PREFIX = MIN(R[3]C /><MIN(R[3]C:R[MyCount R[MyCount]C Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), ->MAX(R[3]C:R[" & MyCount & " - 1]C)), ""buy"", """"))"</MIN(R[3]C:R[MyCount>

<MIN(R[3]C:R[MyCount R[MyCount]C Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), -></MIN(R[3]C:R[MyCount>
<MIN(R[3]C:R[MyCount R[MyCount]C Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), ->... but for CMAX; what is that?


</MIN(R[3]C:R[MyCount>
Thank you for the answer. the code should be:

ActiveCell.FormulaR1C1 = _
"=IF(AND(R[2]C=""Adj Close"", R[" & MyCount & "]C>MAX(R[3]C:R[" & MyCount & " - 1]C)), ""buy"", """"))"



<MIN(R[3]C:R[" Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), - p & MyCount ? <><MIN(R[3]C:R[" Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), - ?]C & MyCount R[? ?><MIN(R[3]C:R[" Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), - ?]C & MyCount R[? ?><MIN(R[3]C:R[" Close??, Adj IF(AND(R[2]C="" ??sell??, 1]C)), - ?]C & MyCount R[? ?>The compilor still gave me the same error after I replaced "MyCount" with "&MyCount&"...Could u please help?

Thanks,

Rachel
</MIN(R[3]C:R[">
</MIN(R[3]C:R[">
</MIN(R[3]C:R[">
</MIN(R[3]C:R[">
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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