function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rud_AnnamhRud_Annamh 

Validation: If [Date Field] > 180 days - please help!

Hello!

 

This should be easy, but is not working for some reason.

 

I would like to return a value in a number field of 0 if the date in a specific field is more than six months ago, or 2.5 if the date is within six months.

 

My formula is currently:

 

If( Proof_of_Address_Date__c  >  TODAY() +180, 2.5, 0)

 

But this is not providing the correct result.

 

Any help would be really appreciated. Thanks so much.

Best Answer chosen by Admin (Salesforce Developers) 
RArunrajRArunraj

Hi,

 

The formula is

 

IF( Proof_of_Address_Date__c < TODAY() -180,0, 2.5)

 

Thanks,

Arunraj

All Answers

RArunrajRArunraj

Hi,

 

The formula is

 

IF( Proof_of_Address_Date__c < TODAY() -180,0, 2.5)

 

Thanks,

Arunraj

This was selected as the best answer
Rud_AnnamhRud_Annamh

Thank you RArunraj, that fixed it!

 

I really appreciate your help. 

Shashikant SharmaShashikant Sharma

I am sorry mate but it looks to me that 180 is not the full proof solution.

 

Take an example if current date is 23rd june so date after 6 months should be 23 december but if you add 180 it will not give you 23 december.

Rud_AnnamhRud_Annamh

Hi Shashikant Sharma

 

You're right of course on the dates, but the solution provided solved specifically what I asked for i.e. 180 days.

 

I was looking for approx 6 months, doesn't matter to us in this instance if it's a few days more or less.

 

So, you're both right and thanks to you both!

 

RA

 

 

Shashikant SharmaShashikant Sharma

I just wanted to make you aware if you are missing something, happy to know your problem get resolved. Arunraj's formula is very effective and perfect if you want only approx six month.

Force ExplorerForce Explorer

What is  the  syntax of  the  IF  statement ?

SAPOCSAPOC

 IF(logical_test, value_if_true, value_if_false)

Force ExplorerForce Explorer

Thanks  mate