Computing.Net > Forums > Office Software > excel calculating differences between times

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

excel calculating differences between times

Reply to Message Icon

Name: wars0696
Date: August 19, 2009 at 09:12:17 Pacific
OS: Windows Vista
Product: Microsoft Microsoft excel 2000 95/98/me/nt
Subcategory: Microsoft Office
Comment:

I am having problems with excel taking one column of time away from another, lets call them A and B (each row is taken from the same occasion). I want to find the difference between A and B (either of which might be the later time) and I want that given in time as either a positive or negative figure. In column C I'm using a basic formal '=SUM(B2-A2)'

At first it wouldn't give negative time values (just #######) but I then found the 1904 date setting. However now I find some values which cross midnight are wrong. For example:

A = 23:34, B = 00:05, C should = 00:31 but instead gives -23:29

I have many thousands of entries and can't start putting dates in with the times. Can anyone please suggest a way around my problem? Really need help on this one!



Sponsored Link
Ads by Google

Response Number 1
Name: wizard-fred
Date: August 19, 2009 at 09:59:44 Pacific
Reply:

You have to correct by adding 24 hrs or subtracting 24 depending on which crosses midnight. This would assume it would be less than 24 hour difference.


0

Response Number 2
Name: wars0696
Date: August 19, 2009 at 13:28:22 Pacific
Reply:

Yes the difference would always be less than 24 hours. What formula could I use to do this?


0

Response Number 3
Name: Mike (by mmcconaghy)
Date: August 19, 2009 at 18:33:18 Pacific
Reply:

First un-tick the 1904 option, and try this:

=IF(A1>B1,B1+1-A1,B1-A1)

MIKE

http://www.skeptic.com/


0

Response Number 4
Name: wars0696
Date: August 20, 2009 at 00:56:27 Pacific
Reply:

That works for the example I gave, but not for others.

For A = 01:00, B = 00:40 if gives 23:40 instead of -00:20
For A = 00:50, B = 23:50 if gives 23:00 instead of -01:00


0

Response Number 5
Name: wars0696
Date: August 20, 2009 at 02:20:30 Pacific
Reply:

I’ve almost solved my problem. There are three main examples of case for values of A and B below and their correct solutions.

A B C (should be) D
(value of =SUM(B-A)
23:34 00:05 00:31 -23:29
01:00 00:40 23:40 -00:20
00:50 23:50 23:00 23:00

Using a new column E and cell F1 with the value 10:00 (Note difference between times A and B will always be under 10 hours) I have been able to gain the correct answer with two formula’s

For the first row =IF(C2<-F1,24-SUM(A2-B2))

For the second two rows =IF(D3>F1,-(24+SUM(A3-B3)), D3)

Can anyone think of a way I can combine these two formulas?


0

Related Posts

See More



Response Number 6
Name: Mike (by mmcconaghy)
Date: August 20, 2009 at 09:14:10 Pacific
Reply:

In case you haven’t figured it out yet, Excel does not like negative numbers while dealing with Time math.

In Excel, when you enter a time without a date, Excel assumes it is January 1, 1900, and it puts a 0 in for the date component of the serial number which is how it deals with dates.

So ALL your times are considered to be on the same day….

It is much simpler to just add a date before the times and then do the math.

MIKE

http://www.skeptic.com/


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: excel calculating differences between times

Excel increasing slowdown, in multi www.computing.net/answers/office/excel-increasing-slowdown-in-multi/1975.html

difference between cd and dvd ver? www.computing.net/answers/office/difference-between-cd-and-dvd-ver/7013.html

Different start time in Outlook? www.computing.net/answers/office/different-start-time-in-outlook/2867.html