I have two time-formatted cells and I need to calculate the difference (e.g., 2.75) in hours between the two.
10:30 AM | 1:15 PM
Simply
=B1-A1
will not do the trick.
Web Applications Stack Exchange is a question and answer site for power users of web applications. It only takes a minute to sign up.
Sign up to join this communityI have two time-formatted cells and I need to calculate the difference (e.g., 2.75) in hours between the two.
10:30 AM | 1:15 PM
Simply
=B1-A1
will not do the trick.
I would use the following formula to calculate the difference in hours.
=(B1-A1)*24
The time difference is calculated in days. If you multiply times 24, you end up with hours. Time difference is 2 hours and 3 quarters of an hour (165 min).
I've prepared an example file for you: Time Tracker formula and included your own solution in C1
.
To calculate the time difference in hours between
10:30 AM | 1:15 PM
Use the formula:
=B1-A1
and format that cell as Duration
2:45:00
In Google Sheets, I used the formula
=Round((hour(A2-A1)*60 + minute(A2-A1))/60,2)
to give me the difference in decimal hours.
I've created this formula, it might help somebody else.
=iferror(if((minute(E3) - minute(D3))>=0;hour(E3)-hour(D3) + (minute(E3) - minute(D3))/60;hour(E3)-hour(D3) + 1 + (60 - minute(E3) - minute(D3))/60))
=B1-A1
toFormat -> Number -> Duration
worked for me! webapps.stackexchange.com/questions/22657/…