+ Start a Discussion
Brian McDonaldBrian McDonald 

counting days between dates

Hi,
We’re on EE and I have been tasked with creating a lifecycle of the below integration stages

Integration Stages
Pre-Coding Date
Coding Date
Review Date
Documentation Date
 
Pre-Coding Life = If Coding Date isblank, count days between Pre-Coding Date and Today; else count days between Pre-Coding Date and Coding Date
Coding Life = If Review Date isblank, count days between Coding Date and Today; else count days between Coding Date and Review Date
Review Life = If Documentation Date isblank, count days between Review Date and Today; else count days between Review Date and Documentation Date
Documentation Life = If Certified Date isblank, count days between Documentation Date and Today; else count days between Documentation Date and Certification Date
Total Life = If Certified Date isblank, count days between Pre-Coding Date and Today; else count days between Pre-Coding Date and Certified Date
 
Regards,

Brian
Best Answer chosen by Brian McDonald
Ronald OlechRonald Olech
Hi Brian,

You need 3 (or more formulas) and a date calculation.  The date calculation is easist, just subtract the dates using regular minus sign and SF will convert that to the difference in days.  The formulas are : IF(condition, value if true, value if false), ISBLANK(field) and TODAY().  The ways these would work togather is like:

IF(ISBLANK(Coding_Date), Today() - Pre_Coding_Date, Coding_Date - Pre_Coding_Date)

Note if the fields are actually DATE/TIME fields, you will need to convert them to date putting the fields inside the DATE() function, like DATE(Pre_Coding_Date).

https://help.salesforce.com/apex/HTViewHelpDoc?id=formula_using_date_datetime.htm&language=en_US

Please select this as Best Answer if it helps you solve the issue.  I can use the points ;)