0

I am trying to create a formula field that we chooose Formula should show time between cancel requested and either cancel confirmed date, saved date or deferred date - whichever one is populated.

The formula that i have made is :

IF (
     Cancellation_Requested_Date__c - Saved_Date__c, 
     Cancellation_Requested_Date__c - Cancellation_Confirmed_Date__c
)

But I am not sure that is the right way of doing this, suggestions needed

Thank you

1

Try below,

 IF (
         Saved_Date__c!=NULL,
         Cancellation_Requested_Date__c - Saved_Date__c, 
         IF(Cancellation_Confirmed_Date__c!=NULL,
            Cancellation_Requested_Date__c - Cancellation_Confirmed_Date__c,
            IF(Deferred_date__c!=NULL,
               Cancellation_Requested_Date__c -Deferred_date__c ,
               NULL
            )
         )
       )

Dont forget to accept answer if its helpful. Tia

9
  • Thank you so much for the reply but its not populating the field ? Can you think of any reason that why its happening
    – Jovi
    Jan 22 '15 at 6:03
  • is your Cancellation_Requested_Date__c populated ? it will populate only if Cancellation_Requested_Date__c is populated & either of Saved_Date__c,Cancellation_Confirmed_Date__c or Deferred_date__c is populated
    – snehakem
    Jan 22 '15 at 6:11
  • 1
    It will be great if you more clarify your requirement with example, Since @snehakem answers looks good. OR What is Return type of your Formula field ? Is it throwing any error, or values - if yes what is it ? Jan 22 '15 at 6:31
  • 1
    Hey Sneha the formula field is a number field, Because i want to Calculate the no of days/Age it has taken from Cancellation Requested Date to Saved Date,Cancellation_Requested_Date__c - Cancellation_Confirmed_Date__c, Cancellation_Requested_Date__c -Deferred_date__c Thanks a lot
    – Jovi
    Jan 22 '15 at 8:04
  • 1
    If(!IsBlank(Saved_Date__c),Abs(Cancellation_Requested_Date__c - Saved_Date__c),If(!IsBlank(Cancellation_Confirmed_Date__c),Abs( Cancellation_Requested_Date__c - Cancellation_Confirmed_Date__c),Abs(Cancellation_Requested_Date__c - Date_Deferred_To__c))) This is right way ! Thanks for the help Sneha
    – Jovi
    Jan 22 '15 at 22:49
0

IF (Saved_Date__c != null, Cancellation_Requested_Date__c - Saved_Date__c, IF(Cancellation_Confirmed_Date__c != null,Cancellation_Requested_Date__c - Cancellation_Confirmed_Date__c, null) )

1
  • Shailendra -- best practice in answering questions on SFSE is to not just provide code but to a) format the code and b) explain why the code solves the problem - perhaps by identifying where the OP went astray.
    – cropredy
    Jan 23 '15 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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