Hi all I am working on a formula field checkbox such that the checkbox should get checked if the Expiry_date__c of the record is within exactly one month.
IF( ( MONTH( Expiration_Date__c)-MONTH(TODAY ) )<=1)
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityHi all I am working on a formula field checkbox such that the checkbox should get checked if the Expiry_date__c of the record is within exactly one month.
IF( ( MONTH( Expiration_Date__c)-MONTH(TODAY ) )<=1)
The formula which you have written has below issues.
Month()
will return the month number of the date so if date is November 15 and current date in November 17 it will still return true also the if()
is incomplete.
You can try the below formula
TODAY() < =Expiration_Date__c && TODAY()>= ADDMONTHS(Expiration_Date__c,-1)
which will subtract one month from expiration date and check if it is today is less that expiration date and greater than expiration date minus 1 .
Not sure if it fits in your requirements or not but if the expiry date has passed, it makes sense that product is still expired i.e. from one month before expiry date record must be marked as expired and left as expired so it should be just TODAY()>= ADDMONTHS(Expiration_Date__c,-1)