ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Subtracting Dates - Mike (https://www.excelbanter.com/excel-discussion-misc-queries/146542-subtracting-dates-mike.html)

SJUCatch27

Subtracting Dates - Mike
 
Hi,

I'm trying to figure out the elapsed time (or the turnaround time) between
two dates at work. I have input it as such:

Date Received: 5/4/07 3:41 PM
Date Due By: 5/8/07 1:40 PM

Using this formula: =(DAY(G5)-DAY(F5))&" days and "&TEXT(G5-F5,"h:mm")

For that specific time frame, the formula works perfectly. I have this for
an answer: 4 days and 21:59

However, when these two dates come up, I have a problem.

Date Received: 4/30/07 4:26 PM
Date Due By: 5/3/07 1:00 PM

For that date range, I bring this back for an answer: -27 days and 20:34

I know, in theory, why it is pulling back that answer, but does anybody know
what adjustments I could make to the formula to bring me back the answer I'm
looking for? Thanks a lot.

JE McGimpsey

Subtracting Dates - Mike
 
One way:

=INT(G5-F5) & " days and " & TEXT(MOD(G5-F5,1), "h:mm")


XL stores date/times as offsets from a base date, with days as integers
and times as fractions.


In article ,
SJUCatch27 wrote:

Hi,

I'm trying to figure out the elapsed time (or the turnaround time) between
two dates at work. I have input it as such:

Date Received: 5/4/07 3:41 PM
Date Due By: 5/8/07 1:40 PM

Using this formula: =(DAY(G5)-DAY(F5))&" days and "&TEXT(G5-F5,"h:mm")

For that specific time frame, the formula works perfectly. I have this for
an answer: 4 days and 21:59

However, when these two dates come up, I have a problem.

Date Received: 4/30/07 4:26 PM
Date Due By: 5/3/07 1:00 PM

For that date range, I bring this back for an answer: -27 days and 20:34

I know, in theory, why it is pulling back that answer, but does anybody know
what adjustments I could make to the formula to bring me back the answer I'm
looking for? Thanks a lot.


Gary''s Student

Subtracting Dates - Mike
 
=DATEDIF(F5,G5,"y")&" years, "&DATEDIF(F5,G5,"ym")&" months,
"&DATEDIF(F5,G5,"md")&" days "&TEXT(MOD(G5-F5,1),"hh "" hours "" mm"" minutes
"" ss ""seconds""")

will return:

0 years, 0 months, 3 days 20 hours 34 minutes 00 seconds

--
Gary''s Student - gsnu200729


"SJUCatch27" wrote:

Hi,

I'm trying to figure out the elapsed time (or the turnaround time) between
two dates at work. I have input it as such:

Date Received: 5/4/07 3:41 PM
Date Due By: 5/8/07 1:40 PM

Using this formula: =(DAY(G5)-DAY(F5))&" days and "&TEXT(G5-F5,"h:mm")

For that specific time frame, the formula works perfectly. I have this for
an answer: 4 days and 21:59

However, when these two dates come up, I have a problem.

Date Received: 4/30/07 4:26 PM
Date Due By: 5/3/07 1:00 PM

For that date range, I bring this back for an answer: -27 days and 20:34

I know, in theory, why it is pulling back that answer, but does anybody know
what adjustments I could make to the formula to bring me back the answer I'm
looking for? Thanks a lot.


JE McGimpsey

Subtracting Dates - Mike
 
Yes, but try it with

F5: 01/31/2007 15:20
G5: 03/01/2007 14:10

0 years, 1 months, -2 days 22 hours 50 minutes 00 seconds

Probably not what the OP wanted...

Better just to do the math.


In article ,
Gary''s Student wrote:

=DATEDIF(F5,G5,"y")&" years, "&DATEDIF(F5,G5,"ym")&" months,
"&DATEDIF(F5,G5,"md")&" days "&TEXT(MOD(G5-F5,1),"hh "" hours "" mm"" minutes
"" ss ""seconds""")

will return:

0 years, 0 months, 3 days 20 hours 34 minutes 00 seconds


SJUCatch27

Subtracting Dates - Mike
 
Thank you for your first post. It seems to be working the way I wanted it to.

-Mike

"JE McGimpsey" wrote:

Yes, but try it with

F5: 01/31/2007 15:20
G5: 03/01/2007 14:10

0 years, 1 months, -2 days 22 hours 50 minutes 00 seconds

Probably not what the OP wanted...

Better just to do the math.


In article ,
Gary''s Student wrote:

=DATEDIF(F5,G5,"y")&" years, "&DATEDIF(F5,G5,"ym")&" months,
"&DATEDIF(F5,G5,"md")&" days "&TEXT(MOD(G5-F5,1),"hh "" hours "" mm"" minutes
"" ss ""seconds""")

will return:

0 years, 0 months, 3 days 20 hours 34 minutes 00 seconds




All times are GMT +1. The time now is 03:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com