change the display of the numbers to time instead of number
then input in time format, e.g. 7:30 16:15 or 4:15 pm
then using the time format as input you can use
=(D7-C7)-(D7-C7>=5/24)*1/48-(D7-C7>=10/24)*1/48
the result is right in time format
multiply this by 24 and display as number instead of time if you want the result in decimal hours
if you want mixed input of time format and decimal format, you are creating yourself an interesting problem, but you can probably safely assume that anything > 1 was in decimal format and build your checks from that. You cannot be sure of course, so maybe you should first decide what format you actually want.
Regards
Bookmarks