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
LudivineLudivine 

formula with if or case

Hi experts,
I need your help to build a formula as I am stuck here and don't know how to achieve the result that I want.

This is my formula :
if(ISNULL(Benefit_End_Date__c),12,round((Benefit_End_Date__c - Expected_Impact_Date__c),2)/30)
This formula returns 0 when the difference between the 2 dates are less than 30 days, so when there is less than a month.
In that case I would like to return 1. How cvan I do that?
It blocks me to implement a method as each time the result is 0 I get an error from Apex ...
Many thanks in advance for the time you will spend on my issue :)
Ludivine
Best Answer chosen by Ludivine
GulshanRajGulshanRaj
Hi @Ludivine,

Try this:
IF(ISNULL(Benefit_End_Date__c),12,IF((ABS(Benefit_End_Date__c - Expected_Impact_Date__c)<30),1,0))


If this helps you, mark this question as solved and choose best answer so it will help other in future to choose best solution. 

Thanks
Gulshan Raj

All Answers

GulshanRajGulshanRaj
Hi @Ludivine,

Try this:
IF(ISNULL(Benefit_End_Date__c),12,IF((ABS(Benefit_End_Date__c - Expected_Impact_Date__c)<30),1,0))


If this helps you, mark this question as solved and choose best answer so it will help other in future to choose best solution. 

Thanks
Gulshan Raj
This was selected as the best answer
LudivineLudivine
Fantastic, it works!! thank you Gulshan!!
GulshanRajGulshanRaj
Nice. Can you please mark this question as solved?