Number of days + or -

Copper Contributor

I am trying to get the difference in the number of days between two dates and it works if the target completion date is before the completion date using this formula: =DATEDIF(H3,J3,"d"). I do get the correct number of days using this formula, however, I would ideally like is a plus or minus in front of that number (e.g., + if the project went past the target date, and - if the project was completed sooner). I can apply conditional formatting to the rows after to change the color of the number if I get that far.

 

When the completion date is before the target completion date (e.g., completed project early), I get the #NUM! error, which I expected. But I cannot find a way to get exactly what I am looking for. Hopefully I am explaining this clearly. The formula in L4: =DATEDIF(H4,J4,"d")

 

JennyBranum_1-1724279427980.png

 

 

 

 

 

3 Replies
With Excel's default date settings (the "1900 date system"), Excel dates are internally represented as the number of days since (approximately) 1 Jan 1900. So you can simply subtract one date from another to get the difference (positive, negative, or zero).
Thank you. Simple I will try that tomorrow.
Oh, I should have mentioned... Excel will by default format the cell containing the subtraction formula as a Date. Just change that format to General (or Number, if you prefer).