views:

63

answers:

3

Suppose I have 2 timestamp dates:

  1. 2/24/2010 1:05:15 AM
  2. 2/25/2010 4:05:17 AM

Can anyone please advise what function should I use in Excel to get the difference in hours and minutes?

Thanks.

+2  A: 

The difference in hours:

=(A2-A1)*24

The difference in minutes:

=(A2-A1)*24*60

The difference in hours and minutes:

=TRUNC((A2-A1)*24)      - the hours portion
=MOD((A2-A1)*24*60,60)  - the minutes portion
ar
i found that this will also work: =TEXT(A2-A1,"h:mm") for my case
jl
A: 

Excel is able to handle date and time arithmetic. It does this by holding the dates and times as decimals. If you key in a date and time in a format that Excel recognises it will (helpfully!) hold the data as a date and time data type. The integer bit is days, and the decimal bit is time. You can use a time cell format to display the time bit in hours minutes seconds etc, or you can convert the decimal to hours, minutes and seconds using 60 in a simple formula

The text formula works by displaying the answer in a time format.

alastair