View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default elapsed time in msgbox

Aah yes! That is because DATEDIF works out all of the differences in months
and days etc. without regard to the true date differences.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Rick" wrote in message
...
If you put the formula into a cell

=DATEDIF($A$4,NOW(),""y"")&"" years, ""&DATEDIF($A$4,NOW(),""ym"")&""

months, ""&DATEDIF($A$4,NOW(),""md"")&"" days,"" &TEXT(NOW()-$A$4,""h"") &""
hours, "" &TEXT(NOW()-$A$4,""m"")&"" minutes, "" & TEXT(NOW()-$A$4,""s"") &
"" seconds"""

and the put the dateserial into A4 "37790.0756944444"

you get a different answer than the seemingly same formula in the

immediate window. Also, if you cahnge the formatting, ie. yyy instead of y
or mmm instead of mm, the result changes significantly. Jul Months, etc.
Could it be how vb interprets NOW? I've tried TODAY & DATE, all of which
produce different results than in a worksheet formula. I know I'm new at
this, but I'm really confused at how the math is done.