Search the Site


bottom corner

Calculating time difference in Excel

This article demonstrates how to calculate the difference between two date, time, or date-time fields in Excel using simple formulas.

This page is filed under keyword(s): excel.

For the purpose of the demonstration, in an Excel spreadsheet, let's say we have a date-time value of "9/13/14 3:02 PM" in cell A2 and "9/13/14 5:43 PM" in cell B2. Even though the screen displays them in a format friendly to me at my location in the United States, in the background Excel actually treats them as a decimal number that is universal regardless of the display formatting. In this case the two values are actually 41895.63 and 41895.74, respectively; the details on this number is outside the scope of this particular article. Getting back on track, in order to calculate the number of days, hours, or minutes that has elapsed between these two values, we can simply use these formulas:

Difference in days:    =(B2-A2)
Difference in hours:   =(B2-A2)*24
Difference in seconds: =(B2-A2)*24*60

Did you find this page useful? Please consider browsing other articles or subscribing to the RSS feed to keep up with latest.

This page is filed under keyword(s): excel.
Author: C. Peter Chen
Last updated: 11 Sep 2014

bottom corner