+ Start a Discussion
Melissa Parker 03Melissa Parker 03 

IF Statement Formula Help

HI! I am working on this formula below and receiving this error:  Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 4

I have tried everything that I could to change this. please help

IF(
IF(
DATEVALUE(CreatedDate)  < DATEVALUE("2017-04-10"),
REVVY__Billing_Frequency_WF__c = 'Monthly', Annual_Amount__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Yearly', REVVY__Yearly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Weekly', REVVY__Weekly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'One Time', REVVY__Extended_Price_Display_F__c,  REVVY__Extended_Price_Display_F__c + REVVY__One_Time_Extended_Price_S__c)))),
IF(
REVVY__Billing_Frequency_WF__c = 'Monthly', Annual_Amount__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Yearly', REVVY__Yearly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'Weekly', REVVY__Weekly_Total_Value_Display_F__c , 
IF (REVVY__Billing_Frequency_WF__c = 'One Time', REVVY__Extended_Price_Display_F__c,  REVVY__Extended_Price_Display_F__c  )))))
bouscalbouscal
A Case statement may be a better solution 
 
CASE(REVVY__Billing_Frequency_WF__c='Yearly', REVVY__Yearly_Total_Value_Display_F__c, 
            REVVY__Billing_Frequency_WF__c='Yearly', REVVY__Yearly_Total_Value_Display_F__c, 
            REVVY__Billing_Frequency_WF__c='Yearly', REVVY__Yearly_Total_Value_Display_F__c, 
            <default if none are true>
)

 
bouscalbouscal
Here's your formula slightly modified, check the date, then check the other values if the date comparison is true.
 
IF(DATEVALUE(CreatedDate)  < DATEVALUE("2017-04-10"),
	IF(
		REVVY__Billing_Frequency_WF__c = 'Monthly', Annual_Amount__c , 
		IF (REVVY__Billing_Frequency_WF__c = 'Yearly', REVVY__Yearly_Total_Value_Display_F__c , 
			IF (REVVY__Billing_Frequency_WF__c = 'Weekly', REVVY__Weekly_Total_Value_Display_F__c , 
				IF (REVVY__Billing_Frequency_WF__c = 'One Time', REVVY__Extended_Price_Display_F__c,  
				REVVY__Extended_Price_Display_F__c + REVVY__One_Time_Extended_Price_S__c)))),
	IF(
		REVVY__Billing_Frequency_WF__c = 'Monthly', Annual_Amount__c , 
		IF (REVVY__Billing_Frequency_WF__c = 'Yearly', REVVY__Yearly_Total_Value_Display_F__c , 
			IF (REVVY__Billing_Frequency_WF__c = 'Weekly', REVVY__Weekly_Total_Value_Display_F__c , 
				IF (REVVY__Billing_Frequency_WF__c = 'One Time', REVVY__Extended_Price_Display_F__c,  
				REVVY__Extended_Price_Display_F__c  )))))