View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Time difference function

Excel doesn't play nice with negative times unless you change a setting.

Tools|Options|Calculation tab|Check 1904 date system

Be aware that your existing dates will be now be off by 4 years and one day.
You can fix this, though. But a bigger problem may be when you copy dates from
one workbook to another (each using different date systems).

Saved from a previous post:

Be aware that any existing date will now be off by 4 years and 1 day. And
copying dates between workbooks becomes a problem, too.

One workbook was using a base year of 1900 and the other was using 1904.
(tools|options|calculation tab|1904 date system)

One way to add those four years back is to find an empty cell, put 1462 into
that cell.

Copy that cell.

Select your range that contains the dates. Edit|PasteSpecial|click Add (in the
operation box).

You may have to reformat the cell as a date (mine turned to a 5 digit number).
But it should work.

You may want to do it against a copy...just in case.

(I'm not sure which one you'll fix. You may want to edit|pastespecial|click
subtract.)

Most windows users use 1900 as the base date. Mac users (mostly??) use 1904 as
the base date.

======
Another option would be to use a formula that returned text (no longer a
number/time):

=if(i3<j3,"-","")&text(abs(i3-j3),"hh:mm")

Where i3 and j3 are real times.


Evan wrote:

Just corrected a mistake, function is now =TIMEVALUE(TEXT(I3, "mm:ss")) such
that 3:00 = .125, 02:04 = .166666667 the difference = -0.41666667. So I have
a new problem a negative number. Is this more easily solved by converting
all time into seconds using 86400? Then my problem is how to convert the
seconds back to a mm:ss format. Already trid to format the column using
Format Custom mm:ss but it doesn't work.

"Evan" wrote:


--

Dave Peterson