# How to make a date formula which calculates current month + 3 Full months in Salesforce

I am using a Process builder to set value to the field expiry_date__c based on booking_date__c

Example 1:

If booking_date__c is 12th June 2017, the expiry_date__c must be calculated as current month + 3 full months from July. So expiry date must get populated to 30th September.

Example 2: If booking_date__c is 5th February 2017, expiry_date__c must be 31st May 2017

• expiry_date__c is a formula field of just date field ? Jun 12, 2017 at 6:06
• Try with this logic. DATE(YEAR(StartDate),MONTH(StartDate)+3,1)-1 Jun 12, 2017 at 6:48
• Think it should be DATE(YEAR(StartDate),MONTH(StartDate)+4,1)-1. if you have 3 it goes to May but cheryl wants it to be end of the 3rd month. Jun 12, 2017 at 7:04
• @ShravanBoddula your formula is not working, when month is October or further months Jun 12, 2017 at 7:12
• @MuzammilBajaria - the 'expiry_date__c' is a date field Jun 12, 2017 at 7:27

Formula should consider two cases, when month <= 8 and month > 8. The following formula works for any date.

``````IF(
MONTH(Date__c) <= 8,
DATE(
YEAR(Date__c),
MONTH(Date__c)+4,
1)
-1
,
DATE(
YEAR(Date__c)+1,
MONTH(Date__c)+4-12,
1)
-1
)
``````
• That works perfect @Alexander, thank you. So I see the catch was to split them in two different cases. Jun 12, 2017 at 10:35