function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shannon DonnellyShannon Donnelly 

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 :
  • ERROR: Incorrect number of paramenters for function "IF()". Expected 3, recieved 2
I am relativitly new to this, so any help or suggestions on how I can better write this formula will be greatly appreciated.

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))))))
 
Best Answer chosen by Shannon Donnelly
Malni Chandrasekaran 2Malni Chandrasekaran 2
Shannon,
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

Malni Chandrasekaran 2Malni Chandrasekaran 2
Shannon,
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
 
This was selected as the best answer
Shannon DonnellyShannon Donnelly
Thank you!