0

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)
10
  • Hi, Can you edit the post and provide details like what you have tried and where you are struck Oct 17, 2022 at 4:51
  • @SaiPraveenKakkirala Edited, I am not exactly sure if this is the way. Took the difference of the current month with the expiry date month and checking if it is less than or equal to one.
    – PJ98
    Oct 17, 2022 at 4:59
  • Are you looking if Expiration Date should be in same month of today or for next 30 days? Oct 17, 2022 at 5:01
  • @SaiPraveenKakkirala My requirement is suppose the expiry date is Nov 17 then it checks if the current date is within one month so Oct 17 is within one month hence the checkbox checks.
    – PJ98
    Oct 17, 2022 at 5:03
  • @SaiPraveenKakkirala It doesn't need a check for thirty days after the expiry date only before
    – PJ98
    Oct 17, 2022 at 5:08

2 Answers 2

0

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 .

0

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)

Not the answer you're looking for? Browse other questions tagged or ask your own question.