How to get the difference in minutes between two dates in Microsoft Excel?

Linux Rules picture Linux Rules · Dec 11, 2012 · Viewed 90.7k times · Source

I am doing some work in Excel and am running into a bit of a problem. The instruments I am working with save the date and the time of the measurements and I can read this data into Excel with the following format:

   A           B
1 Date:      Time:
2 12/11/12   2:36:25
3 12/12/12   1:46:14

What I am looking to do is find the difference in the two date/time stamps in mins so that I can create a decay curve from the data. So In Excel, I am looking to Make this (if the number of mins in this example is wrong I just calculated it by hand quickly):

   A           B                 C
1 Date:      Time:       Time Elapsed (Minutes)
2 12/11/12   2:36:25               -
3 12/12/12   1:46:14            1436.82

I Have looked around for a bit and found several methods for the difference in time but they always assume that the dates are the same. I exaggerated the time between my measurements some but that roll over of days is what is causing me grief. Any suggestions or hints as to how to go about this would be great. Even If I could find the difference between the date and times in hrs or days in a decimal format, I could just multiple by a constant to get my answer. Please note, I do have experience with programming and Excel but please explain in details. I sometimes get lost in steps.

Answer

K_B picture K_B · Dec 11, 2012

time and date are both stored as numerical, decimal values (floating point actually). Dates are the whole numbers and time is the decimal part (1/24 = 1 hour, 1/24*1/60 is one minute etc...)

Date-time difference is calculated as:

date2-date1

time2-time1

which will give you the answer in days, now multiply by 24 (hours in day) and then by 60 (minutes in hour) and you are there:

time elapsed = ((date2-date1) + (time2-time1)) * 24 * 60

or

C3 = ((A3-A2)+(B3-B2))*24*60