 ShowAll Questionssorted byDate Posted nununi

# Formula field showing #Error!

The following formula is shoing an error.
DATE(
YEAR(CurrentEndDate__c + GracePeriod__c ),
(MONTH(CurrentEndDate__c + GracePeriod__c)+1),
(1)
)-1

CurrentEndDate__c = 11/30/2015
GracePeriod__c = 30

Please help! Best Answer chosen by nununi Ronald Olech
The error is because during the months of November and December the value of (MONTH(CurrentEndDate__c + GracePeriod__c)+1) is going to be 13 and 14.

I would recommend separating this in three formulas with a nested IF statement
IF ((MONTH(CurrentEndDate__c + GracePeriod__c)+1)<13, {use formula above},IF((MONTH(CurrentEndDate__c + GracePeriod__c)+1)<14,{formula for November},{formula for December},))

### All Answers Matthias Thal
Please Try (not tested)

DATE(
YEAR(CurrentEndDate__c + GracePeriod__c),
MONTH(CurrentEndDate__c + GracePeriod__c) + 1,
1
)- 1 Ronald Olech
The error is because during the months of November and December the value of (MONTH(CurrentEndDate__c + GracePeriod__c)+1) is going to be 13 and 14.

I would recommend separating this in three formulas with a nested IF statement
IF ((MONTH(CurrentEndDate__c + GracePeriod__c)+1)<13, {use formula above},IF((MONTH(CurrentEndDate__c + GracePeriod__c)+1)<14,{formula for November},{formula for December},))

This was selected as the best answer