Pages

How to find the difference between two time values

Calculating the difference between two times (or date-times) in Google Spreadsheets is just as simple as calculating the difference between two dates, provided the time values are formatted as Times.

You simply do a "minus" between the later time and the earlier one.

At its simplest, you just do a minus calculation, like this:
C5 = C4 - C3

The result that is shows is the time differences, expressed as the number of days between the two values.

You may want to do further calculations, or apply Duration formatting, to make this number more user-friendly.



Troubleshooting

If it looks like your time difference calculation is not working correctly, then then are are few things to check.

  • Are your time values (ie not just the result) formatted as Times?
    Check this under menu: Format > Number > Time.  

    NB   It is not the same as the Font of "Times", which is totally different
  • Do you know that what is shown is the number of days, and this may be a fraction or decimal value. 
Possibly it is not  formatted the way you want it to be. 
Check the formatting under Format > Number, and remember that 15 minutes = 0.25 of an hour, or 0.010416667 of a day.


Extra for experts

A simple minus calculation only works correctly if:

  • Both times are in the same time-zone
  • If the later time is on a different day, then the values that you are calculating on must both have a "date" part as well as a "time" part.

If you need to cover these cases, then check back again soon, so see posts explaining how to handle these situations.



Was this helpful? You may also need to read

Calculating the difference between two dates
Display formats and date / time differences

No comments:

Post a Comment