 ShowAll Questionssorted byDate Posted tnewquist21.3971755974677437E12

# 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.

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 )) William Tran
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))
)```