IF Function strange bug

Merlini

New Member
Joined
May 24, 2018
Messages
10
Hi all,

Iam trying to autofill an Excel and the following code gives a strange fault:

ActiveWorkbook.ActiveSheet.Range("T2:T50").FormulaR1C1 = "=IF((RC[-9])>(R[-1]C[-9]), RC[-2], RC[-1])


The formula isn't correct on row 10, 20, 30 and so on because it uses row 1, 2, 3 and so on.
Any one of You knows why this is? Or has a solution?

Thanks in advance!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
What exactly is wrong with the formula in row 10?
I get K10 > K9 which I would expect
 
Upvote 0
This is what I get
=IF((K10)>(K9), R10, S10)
If you run that one line of code on a new (blank) sheet what do you get?
 
Upvote 0
Glad to help & thanks for the feedback.
Might be worth checking if you have any event code on the sheet, that could be messing up the formula.
 
Upvote 0
I found my mistake. Before the formula I changed all the "0" in "". Now I do that afterwards.
 
Upvote 0

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