Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Melissa 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

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  )))))
bouscal
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>
)```

bouscal
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  )))))```