View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph
 
Posts: n/a
Default I need to find the yy/mm/dd AND hh:mm:ss between 2 time stamps

"Pontoon" wrote in message
...
I need to work out the number of years, months, days AND the elapsed time
between two timestamps. I can compare dates OR Times, but not both
together.

If I do a simple subtract ( A1-A2 ) with the results in A3 formatted using
the custom format
yy" Years" mm" Months" dd" Days" hh" Hours" mm" Minutes" ss" seconds"

it almost works - HOWEVER Excel seems to add a spurious month to the
results.

(It seems to also do this even if I enter a zero into a cell, then format
it
using the same custom format! )

I must be doing something stupid, so any help would be more than welcome.


Don't forget that when you format a number as a date/time in Excel, the yy
mm dd are a date (counting from 1st January 1900).
Hence if you feed it a number 6, for example, it will be treated as 6th
January 1900 if you try to format it as a date, and if you split that format
up the dd part will be 6 and the mm part will be 01 (for January).

You may do better with the DATEDIF function:
http://www.cpearson.com/excel/datedif.htm
--
David Biddulph