Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Subtraction of Date/Time Values

  Asked By: Cameron    Date: Nov 12    Category: MS Office    Views: 629
  

I have looked in all of the usual places, and have done several
searches on the web for an answer to this problem, and I am stumped.
It seems like it should be a simple answer, but I'm not seeing it. I'm
hoping someone here can help. What I have are two cells in a worksheet
that contain Date/Time Values. One is for starttime(B2) and one is for
endtime(B3). All I want to do is subtract the starttime from the
endtime and then display the difference(B4) in hh:mm:ss.

I was handling this with a simple formula on the sheet in B4:
=B3-B2
B4 is formatted for Time. This works great unless the date parts of
the date/time values are different days, because the date part of the
date/time value is ignored.

So now I figure I have to handle this in VBA, but don't have a clue
how to approach it. Can someone out there give me a nudge in the right
direction?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Damian Jones     Answered On: Nov 12

Have you tried Chip Pearson's site which seems to cover almost anything
you may want to do with times?

Try here as a start (bottom of the page has lots of other options):

www.cpearson.com/excel/datetime.htm#AddingDates

 
Answer #2    Answered By: Eamon Jones     Answered On: Nov 12

yes, that was one of the sites I investigated. Still
didn't seem to have my answer.

 
Answer #3    Answered By: Rachael Ferguson     Answered On: Nov 12

In Excel 2007 formatting cell B4 as follows should work: [h]:mm:ss;@

 
Didn't find what you were looking for? Find more on Subtraction of Date/Time Values Or get search suggestion and latest updates.




Tagged: