0

I encountered a wierd behaviour while working with Excel 10: Column B has "time in" in HH:MM format Column C has "time out" in HH:MM format I want column D to have the time difference displayed as decimal amount of hours (so if B4 has 10:00 and C4 has 13:30, D4 will have 3.5). I tried using

=HOUR(C4-B4)+MINUTE(C4-B4)/60

but that gives me 00:00 I then tried:

=HOUR(C4-B4)

which returns 3 for the above example, but when I tried adding minutes it went back to 00:00. I now tried to remove the minutes part and returned to

=HOUR(C4-B4)

just as before, but now it returns 00:00 (for the exact same formula that returned 3 earlier). it only worked again when I used "undo" until I was back at the first try. anything else I tried adding to that formula, even as simple as

=HOUR(C4-B4)+3

returned 00:00. what am I doing wrong?

shayelk
  • 1,606
  • 1
  • 14
  • 32

1 Answers1

0

Well, it turns out every time I tried adding something to the formula, the cell's format went to "time", so having a number it didn't know what to do with, it displayed "00:00". the solution was to right-click the cell (D4)>format cells>general.

shayelk
  • 1,606
  • 1
  • 14
  • 32