formularR1C1 if statement

bradyj7

Board Regular
Joined
Mar 2, 2011
Messages
106
Hi all,

I'm trying to write an if statement for the formulaR1C1 function, to do the following:

In column Q do the following

Check the values in column P, if they are negative then multiply them by 0.6, or else just copy them column Q.

I think the code is something like this

Code:
Range("q3:q" & LastRow).FormulaR1C1 = "=if(rc[-1]<0, rc[-1] * .6 

else rc[-1]"

Appreciate the help
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You just seem to be missing the last part of the formula - the code itself is right.
Code:
Range("q3:q" & Lastrow).FormulaR1C1 = "=if(rc[-1]<0, rc[-1] * .6, rc[-1])"
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,678
Members
452,937
Latest member
Bhg1984

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