Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Calculation using a Date


maura

Recommended Posts

I have a calculation field returning data of type Date.

The calculation is:

StopTreatmentOn =

If(TreatmentDesignation = "T (treatment)", DateTreatmentStarted + 14," ")

 

If the field TreatmentDesignation has the "T(treatment)" value, the StopTreament On field returns a date. If TreatmentDesignation does not have the "T(treatment)" value, I would like the StopTreatmentOn date field to just be blank. Using " " for the default value results in the question mark appearing in the field instead. How can I fix this?

 

Thanks in advance

Link to comment
Share on other sites

Hi Maura,

 

I suggest you use Case instead of If. If requires an 'else' result, while Case does not. Proper syntax for Case is:

 

Case (test1, result1 [, test2, result2, default result]…)

 

With Case, the date returned will be DateTreatmentStarted + 14 if TreatmentDesignation = T (treatment), but since you haven't entered a 'default result,' the field (if TreatmentDesignation T (treatment) will remain blank. smile.gif

 

So your formula would be:

 

Case(TreatmentDesignation = “T (treatment)”, DateTreatmentStarted + 14)

 

LaRetta

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use