Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lnapier
 
Posts: n/a
Default Difference between two Excel Date/Time Stamps


How do I obtain the days, hours, min and sec between two date/time
stamps represented in an excel spreadsheet?

For example:

I have "4/6/2005 10:00:00 AM" in cell A1 and "4/4/2005 7:00:00 AM" in
cell A2. How can I obtain the dd:hh:mm:ss between both date/time stamps
in cell A3?

A
_________________

1 4/6/2005 10:00:00 AM
2 4/4/2005 7:00:00 AM
3 ??Days, ??Hrs, ??Min, ??Sec


--
lnapier
------------------------------------------------------------------------
lnapier's Profile: http://www.excelforum.com/member.php...o&userid=24729
View this thread: http://www.excelforum.com/showthread...hreadid=382956

  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

=INT(A2-A1) & " Days, " & TEXT(MOD(A2-A1,1), "h"" Hrs, ""m"" Min,
""s"" Sec""")

In article ,
lnapier wrote:

How do I obtain the days, hours, min and sec between two date/time
stamps represented in an excel spreadsheet?

For example:

I have "4/6/2005 10:00:00 AM" in cell A1 and "4/4/2005 7:00:00 AM" in
cell A2. How can I obtain the dd:hh:mm:ss between both date/time stamps
in cell A3?

A
_________________

1 4/6/2005 10:00:00 AM
2 4/4/2005 7:00:00 AM
3 ??Days, ??Hrs, ??Min, ??Sec

  #3   Report Post  
LenB
 
Posts: n/a
Default

Another way:
in A3, =A1-A2 or maybe =abs(A1-A2) if A2 is not always earlier.
Format A3 as custom with: d"Days," h"Hrs," m"Min," s"Sec"


lnapier wrote:
How do I obtain the days, hours, min and sec between two date/time
stamps represented in an excel spreadsheet?

For example:

I have "4/6/2005 10:00:00 AM" in cell A1 and "4/4/2005 7:00:00 AM" in
cell A2. How can I obtain the dd:hh:mm:ss between both date/time stamps
in cell A3?

A
_________________

1 4/6/2005 10:00:00 AM
2 4/4/2005 7:00:00 AM
3 ??Days, ??Hrs, ??Min, ??Sec


  #4   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Note that "d" is the format code for day of the month, so this will give
the wrong result if the user's date system setting is the 1904 system.

Likewise it will be wrong if the elapsed time is more than 31 days.


In article <mWqwe.1823172$6l.6237@pd7tw2no, LenB
wrote:

in A3, =A1-A2 or maybe =abs(A1-A2) if A2 is not always earlier.
Format A3 as custom with: d"Days," h"Hrs," m"Min," s"Sec"

  #5   Report Post  
lnapier
 
Posts: n/a
Default


Thanks to JE McGimpsey for the below solution, which works great to
determine the duration between the two dates. I was really impressed
with the time it took for you to respond. Thanks a million. However I
have some more questions if you don't mind.

Solution:

=INT(A2-A1) & " Days, " & TEXT(MOD(A2-A1,1), "h"" Hrs, ""m"" Min,
""s"" Sec""")


Here's a new challenge!

My next question is how can I have the calculation cull out weekends
and holidays from the duration that the formula provides? If I have a
duration that spans across a weekend and then a holiday between two
dates, I don't want the duration result to reflect that time.


Additionally, would it be possible to further constrain the result by
culling out off-hours time between (1700-0600) daily? I only want to
count time that has expired between (0600 - 1700) which is our standard
work day.


--
lnapier
------------------------------------------------------------------------
lnapier's Profile: http://www.excelforum.com/member.php...o&userid=24729
View this thread: http://www.excelforum.com/showthread...hreadid=382956



  #6   Report Post  
LenB
 
Posts: n/a
Default

Ooops. My mistake. Thanks for pointing it out.
Len

JE McGimpsey wrote:
Note that "d" is the format code for day of the month, so this will give
the wrong result if the user's date system setting is the 1904 system.

Likewise it will be wrong if the elapsed time is more than 31 days.


In article <mWqwe.1823172$6l.6237@pd7tw2no, LenB
wrote:


in A3, =A1-A2 or maybe =abs(A1-A2) if A2 is not always earlier.
Format A3 as custom with: d"Days," h"Hrs," m"Min," s"Sec"

  #7   Report Post  
Jesline
 
Posts: n/a
Default


Hi

If I have a loan that is rollover from 15 Dec 04 till 28 Mar 05. I need
a formula to autoculate the accrued no of days for interest in Jan, Feb
and Mar. ie Jan =31 days, Feb = 28 days and Mar = 28 days.

Is it possible?

thks for helping


--
Jesline
------------------------------------------------------------------------
Jesline's Profile: http://www.excelforum.com/member.php...o&userid=24777
View this thread: http://www.excelforum.com/showthread...hreadid=382956

  #8   Report Post  
lnapier
 
Posts: n/a
Default


Jesline,

I'm still trying to figure out my issue. Please start your own
discussion thread concerning your inquiry. Thanks.

Larry


--
lnapier
------------------------------------------------------------------------
lnapier's Profile: http://www.excelforum.com/member.php...o&userid=24729
View this thread: http://www.excelforum.com/showthread...hreadid=382956

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
can you tell me the difference between excel 2000 and excel 2003 mregel Excel Discussion (Misc queries) 2 June 13th 05 02:19 PM
Excel static current date/time problem hpmted Excel Worksheet Functions 1 March 30th 05 09:12 PM
Difference between Publish and Save As Web Page in Excel 2002 johng36 Excel Discussion (Misc queries) 2 February 4th 05 07:29 PM
Difference between ExcelXP and Excel 2003 Wesley Excel Worksheet Functions 2 January 26th 05 11:03 PM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"