• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microsoft Excel Tips and Tricks - Computergaga

  • Home
  • Excel Online Courses
  • Excel Functions List
  • Free Downloads
  • Blog
  • Tutorials
  • About
Home / Formulas / Excel Formula for Elapsed Time in Days, Hours and Minutes

Excel Formula for Elapsed Time in Days, Hours and Minutes

Having to calculate date and time difference in Excel is a common task. Unfortunately, depending on your requirements it is also not always a simple one.

Take this example where column A contains a start date and time, and column B an end date and time. We wish to calculate the elapsed time in days, hours and minutes e.g. 11 days 4 hours 9 minutes.

Calculate date and time difference in Excel

There are multiple ways of calculating date and time difference in Excel. In this scenario we will need to get a little clever.

As you may well know, date and time values are stored as numbers in Excel. For example, the 05/01/2017 10:10 is stored as 42740.42.

Therefore, if I write the formula as =B2-A2, then the result is returned as 2.993056.

To return a result that makes sense to us, we will tackle the date and time parts of the cell separately.

Calculate the Number of Days Difference

To work with just the date part of the cell, we will use the INT function. This function rounds a value down to the nearest integer.

So, if we write the function as below. This will return only the integer part of the date difference, and this is the number of days.

=INT(B2-A2)

Calculate the Elapsed Hours and Minutes

We now need to work on the number of hours and minutes, which is the decimal part.

To return only the decimal part of the B2-A2 formula, we will use the MOD function. This function returns the remainder after a number is divided by a divisor.

We will use it to divide the B2-A2 formula by 1 so that it returns to remainder as the decimal part.

We will then use the HOUR and MINUTE functions to return the hours and minutes from this decimal value.
So the formula below returns the number of hours elapsed.

=HOUR(MOD(B2-A2,1))

And this returns the number of minutes elapsed.

=MINUTE(MOD(B2-A2,1))

Excel Formula for Elapsed Time in Days, Hours and Minutes

Finally, we need to put this altogether as one Excel formula. We can use the ampersand (&) to concatenate the different parts of the formula.

You can construct the result to look however you want. For example the formula below would return the result as 2 days 23 hours and 50 minutes.

=INT(B2-A2)&" Days "&HOUR(MOD(B2-A2,1))&" Hours "&MINUTE(MOD(B2-A2,1))& " Minutes "

And this formula would display the result as 2 days 23:50.

=INT(B2-A2)&" Days "&HOUR(MOD(B2-A2,1))&":"&MINUTE(MOD(B2-A2,1))
Elapsed time in days, hours and minutes

Watch the Video

More Excel Tutorials

  • Excel timesheet with different rates for shift patterns
  • 5 awesome date and time functions
  • Highlight dates over 30 days old
  • Create an Excel Gantt Chart

Related Posts:

  • Case sensitive XLOOKUP feature
    Case Sensitive Lookup with XLOOKUP in Excel
  • Custom sort in Excel
    Custom Sort in Excel
  • Live currency exchange rate in Excel thumbnail
    LIVE Currency Exchange Rate in Excel
  • SWITCH function feature
    Excel SWITCH Function - Nested IF Function Alternative

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Excel SWITCH Function – Nested IF Function Alternative
  • Sum Formulas Only in Excel
  • How to Calculate Age in Excel
  • Custom Sort in Excel
  • Case Sensitive Lookup with XLOOKUP in Excel
Advanced Excel Success book

Footer

Contact

[email protected]

LinkedIn Twitter YouTube

Useful Links

  • Home
  • Excel Online Courses
  • Tutorials
  • Sitemap
  • Privacy Policy
  • Jobs by Jooble

Course Topics

  • Blog
  • Charts
  • Courses
  • Dashboards
  • Downloads
  • Excel Tips
  • Formulas
  • Mail Merge
  • Office
  • PivotTables
  • Power BI
  • Power Pivot
  • Power Query
  • VBA

Join Our Mailing List

© Copyright 2009 Computergaga · All Rights Reserved ·