You need to sign in to do that
Don't have an account?

Incorrect number of parameters
I am trying to write an IF AND formula that calculates a compounded contract value based on the number of years the contract has been in effect. Several sites have expections and have a straightline contract value for the first few years and then every year there after has a escaltor applied to it., but I keep recieving the following :
The formula, so far reads, as :
IF( AND( Name = 'Goya Foods, Inc - Jersey City' , EMS_Contract_Year__c <= 6) ,
EMS_Contract_Amount__c ,
IF( AND ( Name = 'Goya Foods, Inc - Jersey City', EMS_Contract_Year__c > 6),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6)))),
IF( AND( Name = 'Goya Foods, Inc – Secaucus' , EMS_Contract_Year__c <= 6) ,
EMS_Contract_Amount__c,
IF( AND( Name = 'Goya Foods, Inc - Secaucus', EMS_Contract_Year__c > 6),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6)))),
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c <= 3),
EMS_Contract_Amount__c,
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c > 3),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 3)))),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 1))))))
- ERROR: Incorrect number of paramenters for function "IF()". Expected 3, recieved 2
The formula, so far reads, as :
IF( AND( Name = 'Goya Foods, Inc - Jersey City' , EMS_Contract_Year__c <= 6) ,
EMS_Contract_Amount__c ,
IF( AND ( Name = 'Goya Foods, Inc - Jersey City', EMS_Contract_Year__c > 6),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6)))),
IF( AND( Name = 'Goya Foods, Inc – Secaucus' , EMS_Contract_Year__c <= 6) ,
EMS_Contract_Amount__c,
IF( AND( Name = 'Goya Foods, Inc - Secaucus', EMS_Contract_Year__c > 6),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6)))),
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c <= 3),
EMS_Contract_Amount__c,
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c > 3),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 3)))),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 1))))))
If you are trying to 'ELSEIF', please try using CASE as below.
CASE(1,
IF( AND( Name = 'Goya Foods, Inc - Jersey City' , EMS_Contract_Year__c <= 6) , 1, 0), EMS_Contract_Amount__c,
IF( AND ( Name = 'Goya Foods, Inc - Jersey City', EMS_Contract_Year__c > 6), 1, 0), (EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6)))
IF( AND( Name = 'Goya Foods, Inc – Secaucus' , EMS_Contract_Year__c <= 6), 1,0), EMS_Contract_Amount__c,
IF( AND( Name = 'Goya Foods, Inc - Secaucus', EMS_Contract_Year__c > 6), 1, 0), (EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6))),
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c <= 3), 1, 0), EMS_Contract_Amount__c,
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c > 3), 1, 0), (EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 3))),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 1)))
) // End of Case bracket
You may also combine 2 conditions into 1 like
IF( AND(OR( Name = 'Goya Foods, Inc - Jersey City', Name = 'Goya Foods, Inc – Secaucus' ), EMS_Contract_Year__c <= 6)
Hope this helps!
Please mark it as solved if it helps you solve your problem
All Answers
If you are trying to 'ELSEIF', please try using CASE as below.
CASE(1,
IF( AND( Name = 'Goya Foods, Inc - Jersey City' , EMS_Contract_Year__c <= 6) , 1, 0), EMS_Contract_Amount__c,
IF( AND ( Name = 'Goya Foods, Inc - Jersey City', EMS_Contract_Year__c > 6), 1, 0), (EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6)))
IF( AND( Name = 'Goya Foods, Inc – Secaucus' , EMS_Contract_Year__c <= 6), 1,0), EMS_Contract_Amount__c,
IF( AND( Name = 'Goya Foods, Inc - Secaucus', EMS_Contract_Year__c > 6), 1, 0), (EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 6))),
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c <= 3), 1, 0), EMS_Contract_Amount__c,
IF( AND( Name = 'LEVIN_MANAGEMENT_CORPORATION-', EMS_Contract_Year__c > 3), 1, 0), (EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 3))),
(EMS_Contract_Amount__c * ((1 + ( Escalator__c)) ^ ( EMS_Contract_Year__c - 1)))
) // End of Case bracket
You may also combine 2 conditions into 1 like
IF( AND(OR( Name = 'Goya Foods, Inc - Jersey City', Name = 'Goya Foods, Inc – Secaucus' ), EMS_Contract_Year__c <= 6)
Hope this helps!
Please mark it as solved if it helps you solve your problem