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
jclawsonjclawson 

If Formula for Total Days Open or Total Days Still Open Formula

I have this but keep getting errors. Any ideas on how to make this formula work? 


IF(
(NOT(ISPICKVAL( ThinkLP__Status__c ,"Closed","Cancelled",
Today()-datevalue(CreatedDate),
date(Case_Closed_Date__c)-datevalue(CreatedDate))))
Best Answer chosen by jclawson
Ajay K DubediAjay K Dubedi
Hi Jclawson,

Try the following Formula , it's work in my Org:
IF( AND((!ISPICKVAL( ThinkLP__Status__c  ,"Closed")),(!ISPICKVAL( ThinkLP__Status__c  ,"Cancelled"))),
Today()-DATEVALUE(CreatedDate) , CloseDate-DATEVALUE(CreatedDate))
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
 

All Answers

Abdul Khatri 7Abdul Khatri 7
Are you looking to check multiple picklist values within ISPICKVAL function, that will not work. Please try this
 
IF(	
	NOT ( 
		AND 
		( 
			ISPICKVAL ( ThinkLP__Status__c , "Closed" ),
			ISPICKVAL ( ThinkLP__Status__c , "Cancelled" )
		)
	),
	Today()-datevalue(CreatedDate),
	date(Case_Closed_Date__c)-datevalue(CreatedDate)
)

 
Ajay K DubediAjay K Dubedi
Hi Jclawson,

Try the following Formula , it's work in my Org:
IF( AND((!ISPICKVAL( ThinkLP__Status__c  ,"Closed")),(!ISPICKVAL( ThinkLP__Status__c  ,"Cancelled"))),
Today()-DATEVALUE(CreatedDate) , CloseDate-DATEVALUE(CreatedDate))
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
 
This was selected as the best answer
jclawsonjclawson
Thank you both. I was getting an error with the first response. I was able to use the second response from Ajay and just had to modify the Case_Close_Date__c field name. Thank you!