Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
error

We made a wrong turn. Try again.

The objective of this formula is to calculate the number of days to apply a rebate to based on the billing Period Start Date & Period End Date.

Need help fixing the formula - I am using a text formula field and get error message: - [Syntax error. Extra ',' (Related field: Formula)]  , I am lost on where this extra "," is.  I get a similar error message if I chage formula field type to number formula field.

 

Period_Start_Date__c and Period_End_Date__c. are date format fields 

I am trying to get the formula to check if the period is in Q1 of a leap year so the added day is considered in the final calculation if both criteria are true.

 

text(If(And

 (OR(MOD( YEAR(Period_Start_Date__c), 400 ) = 0, 

  AND(MOD( YEAR(Period_Start_Date__c), 4 ) = 0,

    MOD( YEAR(Period_Start_Date__c), 100 ) != 0)

   ),

      CEILING( MONTH (Period_Start_Date__c) / 3  =  1)),

 

(Period_End_Date__c  - Period_Start_Date__c) + 1)),(Period_End_Date__c  - Period_Start_Date__c ))
1 answer
  1. Mar 29, 2016, 4:15 AM

    Here's the proper Syntax:

    text(

    IF(

    And(

    OR(MOD( YEAR(Period_Start_Date__c), 400 ) = 0,

    AND(MOD( YEAR(Period_Start_Date__c), 4 ) = 0,

    MOD( YEAR(Period_Start_Date__c), 100 ) != 0)),

    CEILING( MONTH (Period_Start_Date__c) / 3) = 1),

    (Period_End_Date__c- Period_Start_Date__c) + 1,(Period_End_Date__c- Period_Start_Date__c))

    )

    As a common practice, if your question is answered, please choose 1 best answer. 

    But you can give every answer thumbs up if that answer is helpful to you. 

    Thx

     
0/9000