Advanced Salesforce Formula Date Fields
Calculate the First Day of the Previous Month (Created Date)
IF(MONTH(DATEVALUE(CreatedDate))=1,
DATE(
YEAR(DATEVALUE(CreatedDate))-1,
MONTH(DATEVALUE(CreatedDate))-1,
DAY(DATEVALUE(CreatedDate) - DAY(DATEVALUE(CreatedDate))+1)
),
DATE(
YEAR(DATEVALUE(CreatedDate)),
MONTH(DATEVALUE(CreatedDate))-1,
DAY(DATEVALUE(CreatedDate) - DAY(DATEVALUE(CreatedDate))+1)
)
)
Calculate the First Day of the Month
DATE(YEAR(CloseDate),MONTH(CloseDate),1)
Calculate the Last Day of the Month
DATE(
YEAR(TODAY()),
MONTH(TODAY()),
CASE( MONTH(TODAY()),
1, 31,
2, IF( MOD( YEAR(TODAY()), 4) = 0, 29, 28),
3, 31,
4, 30,
5, 31,
6, 30,
7, 31,
8, 31,
9, 30,
10, 31,
11, 30,
12, 31,
0
)
)
Calculate Weekdays (Number)
Calculate Weekdays (Text)
CASE(MOD( {!CloseDate} - DATE(1900, 1, 6), 7),
0, "Saturday",
1, "Sunday",
2,"Monday",
3, "Tuesday",
4, "Wednesday",
5, "Thursday",
6,"Friday","")
Lead Age (accounting for converted leads)
IF(IsConverted,ConvertedDate - DATEVALUE(CreatedDate), TODAY() - DATEVALUE(CreatedDate))
Contact Age
FLOOR((TODAY()-Birthdate)/365.2425)
Current Week Number
MOD(FLOOR( ( Expected_Launch_Date__c -DATEVALUE("2006-01-01" ))/7),52)+1




