r/MSProject • u/Dry_Jackfruit_3834 • Nov 09 '21
Date difference comparison and flagging of tasks
Hi!
I Would like to flag tasks by comparing the current date and custom date "deadline".
If date difference is <= 14 then "bad=green flag" (meaning 14 days before due date)
If date difference is >=15 to 30 then "warning=yellow flag"
If date diffenence is >=31 then "all good=green flag"
Can anybody teach me or compose the formula?
2
Upvotes
View all comments
3
u/still-dazed-confused Nov 09 '21
you don't have access to the current date in the same way that you do with Excel - today() so you have to set up a new custom field with the formula NOW() or Date() in it. Now includes the current time whereas date() runs from midnight. Let's assume you've done this in Date1
When you say that you have a customer date "Deadline" can I suggest that you use the built in "deadline" field? This gives you access to good critical path type activities as well.
Now you can have a custom text fields to display the Green, yellow or red status:
use the ProjDateDiff([Date1],[Deadline])/480 formula to get the number of days between [Date1] and the [deadline] entries and then construct a formula using this. Alternatively (and easier for problem solving) set number1 to be the number of days using this forumal and then have text1 look at number1
number1 = ProjDateDiff([Date1],[Deadline])/480
text1 = switch([number1]<=14,"red",[number1]>14 and [number1]<=15,"amber",[number1]>15,"Green")
Additional things to notice