If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Calculating time differances

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-08, 17:55
OB1 OB1 is offline
Registered User
 
Join Date: Dec 2007
Posts: 69
Calculating time differances

Hi,

Hoping this is a very simple question.

I need to calculate the differance between a start time and a finish time, which I have done as

=(C2-B2) for example C2 is finish time and B2 is start time

But then I need to calculate how much this is above or below 5:00 hours.

I've done this as:

=(D2-I1) for example D2 is answer to above and I1 is 5:00

This works for positive answers but negative time come up as ########

How can I work out what time differences are above and below 5 hours?

I'm doing this as a clocking in method for hours worked above or below 5 hours? (In a 24 hour clock format)

Hope this all makes sence and someone can help

OB1
Reply With Quote
  #2 (permalink)  
Old 09-28-08, 15:31
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Data types involved please?

If dates, then lookup DateAdd() and/or DateDiff()
If integers, check out Abs()
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 09-28-08, 22:46
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
DateAdd and DateDiff are VBA functions, not native to Excel. So you would need the code installed and then reference the functions that way.

See DateDiff VBA
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #4 (permalink)  
Old 09-29-08, 03:15
OB1 OB1 is offline
Registered User
 
Join Date: Dec 2007
Posts: 69
OK, i'll have a look into those function. Though i've never used VB in Excel before. I was kind of hoping i wouldnt need to get involved with VB, but if its the only way to make Excel have negative times i'll have to. Thanks, i'll let you know how i get on.
Reply With Quote
  #5 (permalink)  
Old 09-30-08, 11:15
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
You don't need to use VBA. Excel displays "######" when a cell contains a numeric value with more digits than can be fitted into the current width. All you need to do is resize the column to see the actual answer. (My mum used to impress her boss with this all the time!)

With regard to the answer that you need, try replacing
Code:
=(C2-B2)
with
Code:
=5-(C2-B2)
A positive answer will mean that the time spent was that much less than five; a negative answer shows how much more than five.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On