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

Need help with formula to calculate number of days remaining in a quarter and check if quarter is Q1 of a leap year.

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.

 (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 ))
William TranWilliam Tran
Here's the proper Syntax:
        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.