Main motive for this blog is not to teach you how to begin with formula but how to keep a grip and make a better understanding on it..So stay tuned and I will be providing a lot of examples with explanations in this series which would help you understand more about formulas
User needs to be create formula field which returns a checkbox,the checbox must be true if all the below conditions are satisfied :
If the owner is equal to one of 4 users(say 15 Digit User Ids are known)
If loggged in date must be greater than the specific date say example Nov 11, 2015.
TODAY() > DATE(2015,11,11)
Here AND is used to combine two conditions(We used AND since the user wants all checkbox to be true only when all the conditions areTRUE,IOR would have been used when User would have required either of the condition to TRUE)
CASE() function is used which should return 1 and TODAY() should be greater than DATE (where DATE(YYYY,MM,DD) function is used to get the DATE)
User needs to create a formula field for a validation rule on Account Object such that its custom field (date type) must not be greater than a specified date let’s say 01/11/15
Custom_Date__c > DateValue(“2015-01-11”)
Please note that if you compare the Custom_Date__c as : Custom_Date__c > 01/11/15 ,then you would get an error something like: Incorrect parameter type for operator ‘>’. Expected Date, received Number. DateValue Method will convert the String to a Date Format.Please check here for more DateTime methods.
User needs a forumla for a validation rule that allows users to enter a date in a custom date field, that can only go 10 days in the past hwen compared with today
(TODAY() – Custom_Date__c) > 10
Two dates can be directly subtracted and there result will be always an integer.Please check here for more DateTime methods.
User need to write a formula field for a validation rule such that for a given record type (15 Digit record type Id provided),User must fill something in Description Field when case status is put to closed.
RecordTypeId <> “15_Digit_Id”,
Here three things are considered,Checked if the record typeId is as desired,Status is closed,and Length of description field is 0.
User want to prevent other users to edit two fields on Cases (Means lock those fields) when the case status is pending
Here OR will check if either of two fields are changed.AND will combine OR condition and check if status is pending