Search code examples
excel-2007

How to calculate the time between two periods of time?


In excel I have a table like this:

Start Time ______| End Time _____ | Days | Hours | Minutes

05/07/2016 10:25 | 05/07/2016 11:00|

05/07/2016 11:26 | 20/08/2016 12:56|

I want to calculate the period of time between Start Time and End Time and automatically to display in the columns Days if the interval is more then 24 hours, or hours or minutes.

It is possible to do this and how ?


Solution

  • Please try:

    =TEXT(INT(B1-A1),"0 ""d""")&" "&TEXT(HOUR(B1-A1),"00 ""h""")&" "&TEXT(MINUTE(B1-A1),"00 ""m""")  
    

    If you want the days not to appear when 0, wrap in an IF function to test for such result and shorten the above formula accordingly for when test is passed.

    SO38973154 example