View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Need a function that calculates time between 2 dates

Just subtract one from the other and format as

d "days, " h "hours, " m "mins, " s "secs"

This falls down if more than 31 days are betgween dates though, where you
would need

=INT(A2-1)-INT(A1+1)+(MOD(A2,1)+(1-MOD(A1,1))=1)&" days "&
TEXT(MOD((MOD(A2,1)+(1-MOD(A1,1))),1),"h ""hours, "" m ""mins, "" s
""secs""")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"RawisTheGameHhH"
<RawisTheGameHhH.2a7z4u_1151678434.2285@excelfor um-nospam.com wrote in
message news:RawisTheGameHhH.2a7z4u_1151678434.2285@excelf orum-nospam.com...

I have been playing around with a function that will give me the
difference between to dates and times.

Example:
A1 contains 6/10/06 10:00AM
A2 contains 6/13/06 10:00PM

I am trying to get a function to give me an answer with how many days,
hours and minutes between the 2 dates/times.

the answer would be 3 days, 12 hours, 0 minutes


--
RawisTheGameHhH
------------------------------------------------------------------------
RawisTheGameHhH's Profile:

http://www.excelforum.com/member.php...o&userid=35945
View this thread: http://www.excelforum.com/showthread...hreadid=557337