Conditional VBA Error

keithb

New Member
Joined
Oct 29, 2008
Messages
42
How do I wright this conditional VBA code?
I cannot make it work.
Any help would be appriciated, I am not good with code.
mpFormulae(1) = "=SUM(RC[-6] * IF(RC[-8] = "Fin", (RC[-2] 1%, 3%)))"

Thanks Keithb
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
It would be something like

Code:
mpFormulae(1) = "=SUM(RC[-6] * IF(RC[-8] = ""Fin"", (RC[-2] 1%, 3%)))"

which compiles but does not look like a valid formula to me. what are you trying to do?
 
Upvote 0
VoG I am doing calculations from one cell into other cells @ different amounts. The following codes work:
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% ))))"
mpFormulae(4) = "=SUM(RC[-9] * IF(RC[-9] > 14994, 7%, IF(RC[-9] > 10994, 6.5%, IF(RC[-9] > 5598, 3%, 3% ))))"
The one I am having trouble with is based on a conditional cell containing "Fin", this needs to return a different calculation. If this cell contains "Fin" I need to calculate 1% if the value is different I need it to calculate 3%
Thanks for your help
Keith
 
Upvote 0
So should it be?


Code:
mpFormulae(1) = "=SUM(RC[-6] * IF(RC[-8] = ""Fin"", (RC[-2] *1%, RC[-2] 3%)))"
 
Upvote 0
Vog that still returns an error.
I think maybe it is not seeing the value of the cell that contains "Fin"
I just don't know enough about these codes to figure it out.
Thanks for you help
keith
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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