Time Difference Calculation for a Custom List
I have a custom list that is a log of import/export completion times. One column contains the start time, a second column contains the end time and a third column calculates the time difference between the two. It's the most basic calculation:
=TEXT(Finished-Started,"h:mm")
This works perfectly for rows where both the start and finish time are on the same day. However, I run into a problem when they are on different days.
How can I run an accurate calculation under a situation like this:
Start: 23:25 (11:25PM 1/17/11)
Finish: 3:04 (3:04AM 1/18/11)
Using the basic calculation from above, the result is 20:21 on the list. But it should be 4:21.
Any ideas?
February 21st, 2011 4:03pm
Hi,
It looks a bit tricky but its actually not.
Here are some links which will guide you.
http://abstractspaces.wordpress.com/2009/05/02/common-date-time-formulas-for-sharepoint-calculated-fields/
Alternate link
http://msdn.microsoft.com/en-us/library/bb862071.aspx
~Anshul
Free Windows Admin Tool Kit Click here and download it now
February 21st, 2011 11:51pm
Hi derekr44,
You can try =Finished-Started directly to calculate the defference between two dates.
And it will reture a number of hours between the dates.
If you use =(Finished-Started)*24, it will reture a number of minutes between the dates.
For more formulas used in calculate column, please read this reference.
http://office.microsoft.com/en-us/windows-sharepoint-services-help/examples-of-common-formulas-HA010105479.aspx
Thanks & Regards,
Emir
February 22nd, 2011 10:30pm
Hi derekr44,
I did a test using TEXT(Finised-Started,”h:mm”) formula. And I had got the right result 3:39.
TEXT formula is used to get hors and minutes between two times, and it would
ignore the Date part, and only calculate the different between Time part.
For example:
Start: 1/17/11 12:00 AM Finish: 1/18/11 12:00 AM, it will return 0 using TEXT formula.
But it will still get right result when finished time is AM and started time is PM.
If you want to get the difference between two dates and calculate dates include Date part, please try the following formulas:
Start: 23:25 (11:25PM 1/17/11)
Finish: 3:05 (3:04AM 1/18/11)
=Finished-Started,
it will return a number of days between the dates.
Return: 0.152777778 (days)
=(Finished-Started)*24,
it will return a number of hours between the dates.
Return: 3.666666667 (hours)
You could also use the mathematical formulas to subtract the
decimals
and convert the decimals to minutes. Please try the follow formula.
=IF(ROUND(((Finished- Started)*24-ROUNDDOWN((Finished-
Started)*24,0))*60,0)=60,(ROUNDDOWN(((Finished - Started)*24),0)&": 00"),(ROUNDDOWN(((Finished-
Started)*24),0)&":"&ROUND(((Finished- Started)*24-ROUNDDOWN((Finished-
Started)*24,0))*60,0)))
Reture: 3: 40
For more formulas used in calculate column, please read this reference.
http://office.microsoft.com/en-us/windows-sharepoint-services-help/examples-of-common-formulas-HA010105479.aspx
Thanks & Regards,
Emir
Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2011 10:32pm