Excel Formula to Subtract Hours

Posted: 04/03/2012

This is just a simple formula that will get the duration in between two times. If just a time is used (e.g. 9:00 PM) it will assume the two values are on the same day. If the date is also included (4/3/2012 9:00 PM) then it will get the difference that goes over days. If there isn’t a valid second cell or the difference is negative I’ve included a IF statement to return 0 (say, if you don’t have an end time yet because it hasn’t occurred, in the case of a time tracking spreadsheet).

    =IF(B1-A1 >= 0, B1-A1, 0)