You need to sign in to do that
Don't have an account?
Laaral
Formula which counts date from months
Hi, I have a problem with my formula which should count End Date from Start Date + Contract Term, but the problem is that Contract Term values are not always divisible by 12? For example (37 or 41) .
Here is my formula before I found out that all the values aren't divisible by 12:
DATE(
(YEAR(Service_Contract_Period_Start_Date__c)+VALUE(TEXT(Service_Contract_Term__c ))/12),
MONTH(Service_Contract_Period_Start_Date__c),
DAY(Service_Contract_Period_Start_Date__c)
)
How should I solve this ?
Here is my formula before I found out that all the values aren't divisible by 12:
DATE(
(YEAR(Service_Contract_Period_Start_Date__c)+VALUE(TEXT(Service_Contract_Term__c ))/12),
MONTH(Service_Contract_Period_Start_Date__c),
DAY(Service_Contract_Period_Start_Date__c)
)
How should I solve this ?
https://help.salesforce.com/HTViewHelpDoc?id=formula_using_date_datetime.htm&language=en_US
you can put
Service_Contract_Period_Start_Date__c + Service_Contract_Term__c*30,
or try this:
Date(
Year(Service_Contract_Period_Start_Date__c) + FLOOR(Service_Contract_Term__c /12)
+
if( month(Service_Contract_Period_Start_Date__c)+ mod(Service_Contract_Term__c ,12)>12,
(month(Service_Contract_Period_Start_Date__c)+ mod(Service_Contract_Term__c ,12))-12, 0),
if( ( month(Service_Contract_Period_Start_Date__c)+ mod(Service_Contract_Term__c ,12) )>12,
mod ( month(Service_Contract_Period_Start_Date__c)+ mod(Service_Contract_Term__c ,12) ,12),
month(Service_Contract_Period_Start_Date__c)+ mod(Service_Contract_Term__c ,12)),
if( AND(
Day (Service_Contract_Period_Start_Date__c )>28,
Month(Service_Contract_Period_Start_Date__c + Service_Contract_Term__c *30)=2), 28,
if( AND( Day (Service_Contract_Period_Start_Date__c )>30,
OR( Month(Service_Contract_Period_Start_Date__c + Service_Contract_Term__c *30)=4,
Month(Service_Contract_Period_Start_Date__c + Service_Contract_Term__c *30)=6,
Month(Service_Contract_Period_Start_Date__c + Service_Contract_Term__c *30)=9,
Month(Service_Contract_Period_Start_Date__c + Service_Contract_Term__c *30)=11)), 30,
Day (Service_Contract_Period_Start_Date__c ))))