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
Rachel Linder 20Rachel Linder 20 

Receiving Error on Formula Field: "Error: Incorrect Number if Parameters for function IF(). Expected 3, received 1"

Hello,
I am converting the following ask into a formula field:
  1. If Stage = Closed Lost, $0, otherwise
  2. If line level detail = Customer Credit, Product Churn or Product Deprecated, $0, otherwise
  3. if Amendment, use Total Price (no change), otherwise
  4. if Renewal and Line Type = Removed Product and Line Level Detail = Bundle Adjs, then “$0”, otherwise
  5. Total Price + ARR Removed
I have it written as such and I am receiving the error - 'Error: Incorrect Number if Parameters for function IF(). Expected 3, received 1"
 
IF(
   ISPICKVAL(Opportunity.StageName,"Closed Lost"),0,
     If( 
        Line_Level_Detail__c='Customer Credit' || Line_Level_Detail__c='Product Churn'  || Line_Level_Detail__c = 'Product Deprecated'), 0,
         IF(
            Opportunity_Record_Type__c  = 'Amendment'),  TotalPrice,
            IF(
               AND
                  ( Opportunity_Record_Type__c = 'Renewal',  Line_Level_Type__c = 'Removed Product',  Line_Level_Detail__c = 'Bundle Adjs'), 0,
                    TotalPrice  +  ARR_Removed__c
)
)
What am I missing in this formula?
 
EuphoristeEuphoriste
Hi, you have errors on ')' position. You need to close all your 'IF' Statements at the end of the formula.

Try this one : 

IF(
        ISPICKVAL(Opportunity.StageName,"Closed Lost"),0,
           IF( Line_Level_Detail__c='Customer Credit' || Line_Level_Detail__c='Product Churn' || Line_Level_Detail__c = 'Product Deprecated', 0,
                  IF( Opportunity_Record_Type__c = 'Amendment', TotalPrice,
                        IF( AND ( Opportunity_Record_Type__c = 'Renewal', Line_Level_Type__c = 'Removed Product', Line_Level_Detail__c = 'Bundle                                  Adjs'), 0, TotalPrice + ARR_Removed__c
                        )
                 )
         ) 
)