Code Error

keithb

New Member
Joined
Oct 29, 2008
Messages
42
Can someone tell me why this code does not work?
I am sure it is something simple, I just can't find it.


mpFormulae(1) = "=SUM(RC[-6] * IF(RC[-5] Range = "Fin", (RC[-2] 1%, 3%)))"
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Does it error out at "Fin" ??
I don't have excel at the moment
but try
Code:
mpFormulae(1) = "=SUM(RC[-6] * IF(RC[-5] Range = ""Fin"", (RC[-2] 1%, 3%)))"

OR
Code:
mp.Formulae(1) = "=SUM(RC[-6] * IF(RC[-5] Range =""Fin"", (RC[-2] 1%, 3%)))"
 
Upvote 0
This code works fine.
mpFormulae(1) = "=SUM(RC[-5] * 3%)"

I need this code to be conditional based on the value of another cell.
If 3 columns back ="Fin" I need to multiply the same cell * 1% instead of 3%.
Thank you for your help.
 
Upvote 0
You need to rearrange your formula
Do the IF statement first and then multiply by SUM(RC[-6]
 
Upvote 0
Michael M These codes work fine.
mpFormulae(2) = "=SUM(RC[-7] * IF(RC[-7] > 14994, 5%, 6%))"
mpFormulae(3) = "=SUM(RC[-8] * IF(RC[-8] > 14994, 7%, IF(RC[-8] > 10994, 6.5%, IF(RC[-8] > 5598, 3%, 3% ))))"
I thought I could just insert a conditional statement based on "Fin" and then use a different calculation.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,728
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