0

can anyone help me out with validation rule for months

# At least 9 months or more from today

it should be like the input 5 Jan should get end of Oct 31,or the input of 10 Jan should get OCT 31 ,or any date in JAN will get me the end date 31 OCT

5
  • What sort of field is this on - date? What have you tried so far?
    – Dave Humm
    Commented Jan 5, 2017 at 8:02
  • @DaveHumm Hi, let me explain you , Date field ,----- Today()+90 gives me 60 days from today but I need for months exactly i.e if today is JAN 5 I need feb ,march, april to added Commented Jan 5, 2017 at 8:16
  • Ok, so input 5 Jan should get 5 October.
    – Dave Humm
    Commented Jan 5, 2017 at 8:50
  • @DaveHumm ,thank for staying in ,it should be like the input 5 Jan should get end of Oct 31,or the input of 10 Jan should get OCT 31 ,or any date in JAN will get me the end date 31 OCT . Commented Jan 5, 2017 at 9:00
  • Is this really a validation you need or a formula field to set the value as you seem to have a fixed date requirement which makes more sense as a formula?
    – Dave Humm
    Commented Jan 5, 2017 at 9:47

1 Answer 1

1

A simple formula that will do it is where I have 2 custom fields both of Date data type, Start_Date__c and Target_Test__c. You could change the <> to a >= to make it greater than or equal to the date.

Target_Test__c <> CASE( MONTH(Start_Date__c) , 
  1, DATE(YEAR(Start_Date__c),10,31) , 
  2, DATE(YEAR(Start_Date__c),11,30), 
  3, DATE(YEAR(Start_Date__c),12,31), 
  4, DATE(YEAR(Start_Date__c)+1,1,31), 
  5, DATE(YEAR(Start_Date__c)+1,02,28), 
  6, DATE(YEAR(Start_Date__c)+1,03,31), 
  7, DATE(YEAR(Start_Date__c)+1,04,30), 
  8, DATE(YEAR(Start_Date__c)+1,05,31), 
  9, DATE(YEAR(Start_Date__c)+1,06,30), 
 10, DATE(YEAR(Start_Date__c)+1,07,31), 
 11, DATE(YEAR(Start_Date__c)+1,08,31), 
 12, DATE(YEAR(Start_Date__c)+1,09,30), 
 DATE(YEAR(Start_Date__c),10,31))

If you need the Specific Date returned then I would think using a formula field with Date return type and the formula from 'CASE..' onwards would work better than manual entry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .