I am trying to calculate the hour difference between two times. What I've been doing now only gives me hour indications like 1:30, 2:45, etc
but I can't make diagrams based on these values. If I get 2:30
as the hour difference, it should become 2,5
. if the difference is 2:45
that should be 2,75
.
Change your formula to:
(B2-A1)*24
and format as General
You should just be able to subtract 1 datetime from the other. Try this:
The problem may be that you are trying to subtract 1 'time' from another 'time' without a date component. In that case, Excel may not recognize your value as a 'time'. Try adding a dummy date to the beginning of the time.
One limitation of this is that you will get an error response of "########" if the 2nd date is earlier than the 1st (because the result is negative). If this is an issue, try "=ABS(A2-A1)*24" instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.