Help with a Formula Converting Two Date Times Giving Number of Days - Answers - Salesforce Trailblazer Community
Ask Search:
Cameron KCameron K 

Help with a Formula Converting Two Date Times Giving Number of Days

Ive created a workflow for a time stamp that updates everytime a record has a given picklist value with the current day and time.

Im trying to figure out how to use that time stamp to determine how many days from that stamp it has been. I created a field called Days_Lead_Status_Unchanged__c (Number) and used this formula, but I am not seeing anything change. Any ideas or help would be greatly appreciated.

DATEVALUE(Lead_Status_Time_Stamp__c) - TODAY ()
Best Answer chosen by Cameron K
Pattie HeintzPattie Heintz
You do not need the second workflow - it should just be a formula field on your object.  Create a new custom formula field with a return type of Number.  Plug the formula you were using above and it should work fine, as long as your Lead Status Time Stamp is being populated correctly.

All Answers

Pattie HeintzPattie Heintz

That formula should be fine - I use it in my org all the time.
You may want to switch em around, so your dates are positive:

Today() - DATEVALUE(Lead_Status_Time_Stamp__c)
Steve MolisSteve Molis
++ PattieH 

Can you create a Report or a List View that displays all of the Fields in your Formula and the Formula results side-by-side and post a screenshot?  If you're getting a bad or unexpected result instead of a Syntax Error, it's gonna make troubleshooting the Formula much easier if we can see both the Input values and the Output results side-by-side.  

Tips & Tricks: Measure twice and cut once with Formula QC List Views and Reports
https://success.salesforce.com/answers?id=9063000000046BfAAI  (https://success.salesforce.com/answers?id=9063000000046BfAAI )
Cameron KCameron K
Thanks Pattie and Steve. Here is additional information, let me know what else I can provide for you. I appreciate your time!

Workflow #1: Update Lead Status TIme Stamp
Rule Criteria: (Lead: Lead Status EQUALS New) OR (Lead: Lead Status EQUALS Assigned) OR (Lead: Lead Status EQUALS In progress)
Field Update: NOW()

Workflow #2: Update Days Lead Status Unchanged
Rule Criteria: NOT(ISBLANK( Lead_Status_Time_Stamp__c))
Field Update: (TODAY() - DATEVALUE(Lead_Status_Time_Stamp__c))


User-added image
Pattie HeintzPattie Heintz
You do not need the second workflow - it should just be a formula field on your object.  Create a new custom formula field with a return type of Number.  Plug the formula you were using above and it should work fine, as long as your Lead Status Time Stamp is being populated correctly.
This was selected as the best answer
Cameron KCameron K
Hot Ticket Pattie that did the trick! Thank you so much for your help! You too Steve!
Steve MolisSteve Molis
User-added image
Pattie HeintzPattie Heintz
(Funny note for Steve Mo,  sorry to hijack your question, Cameron - You have Charlie Brown as your profile pic and I was actually name after Peppermint Patty.  We could be some form of sf wonder twins :P )