| Ashish Mathur wrote
Hi,
Assuming the data above is entered in range A1 2, enter the following formula in cell E2 to get the time difference.
=IF(B2>=D2,TEXT(12-(B2-D2),"hh:mm:ss")+(C2-IF(B2=D2,0,1))-A2,TEXT(D2-B2,"hh:mm:ss")+(C2-A2)).
In Format>Cells>Number.Custom, please enter the following time format in the Type box: [h]:mm:ss
Hope this solves your problem.
|
Hi Ashish,
As I was working with your formula, a sudden idea flashed in my mind, and yes, it worked. Now, I have been able to simplify the formula farther. Here it goes:
=TEXT((C2+D2)-(A2+B2),"[h]:mm:ss")
You know, we were thinking of complicated methods. In fact, Excel does not differentiate between date and time, both are treated as numbers, hence simple addition and subtraction is possible.
I wish we thought of it earlier. Anyway, better late than never.
-Argha Bagchi
http://www.linkedin.com/in/argha