How can i find the days, hours and minutes difference between two columns in a calculated column
-
10-12-2019 - |
Question
I want to create the functionality of this formula which works in excel =Text([end date]-[start date],"d:h:mm")
in a sharepoint calculated column. It works with h:mm, but when I include the d or D I get unexpected results.
Solution
You cannot connect the "d" with a colon to the time value. The colon can only be used to separate hours, minutes and seconds. Use a blank instead of the colon
=Text([end date]-[start date],"d h:mm")
Edit: If the days go over one month, then the following approach may be better:
=IF(End-Start>1,INT(End-Start)&":","")&TEXT(End-Start,"h:mm")
Days will only show if present and can run into the tens of thousands. Note: My regional settings are DMY.
OTHER TIPS
You can also try formats in this post to see if you get the result you want http://panvega.wordpress.com/2008/12/08/ddwrtformatdate-with-different-formatflags/
Saw another example this might work too
Text([end date]-[start date],"d") &":"& Text([end date]-[start date],"h:mm")
CONCATENATE(ROUNDDOWN([end date]-[start date],0),":",TEXT([end date]-[start date],"hh:MM")