Formula for Date/Time Subtraction in Excel

Wednesday, January 23rd, 2008 138 views

This formula will show the difference (in hours) between two cells with date/time values. =IF(INT(B2)-INT(A2)<1,24*(mod(b2,1)-mod(a2,1)),((int(b2)-int(a2))*24)+24*(mod(b2,1)-mod(a2,1))) Press Ctrl-1 to format the cell, on the Number tab choose "Custom," enter this format: ####.0# "hours" The cell will show the number of hours passed between both dates/times, neatly formatted with a custom format displaying the word "hours" ...