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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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