Hi Joe,
THank you for you advice.
The Datevalue function does not convert the text "1/23/2008" yet it does
convert "2008/1/23", this makes me nuts as the timestamp string cannot be
changed.
Should I write some codes but I don't know VB
On Jan 23, 9:43 am, "Derek" <derekch...@sina.com> wrote:
> However, the timestamp "01/23/2008 16:01:00" is a text which
> cannot be converted to a number for subtraction. I tried Datevalue()
> but it does not work. Any Excel function can do that?
Well you could do the following:
=datevalue(left(A1,find(" ",A1))) + timevalue(right(A1,len(A1)-find("
",A1)))
Not sure that is the best way to do the conversion. Also not sure
that converting the text timestamp to a serial number and subtracting
from NOW() is the best way accomplish whatever you want to do. Be
aware that NOW() seems to have an accuracy of about 0.01 seconds, plus
or minus binary representation error.
joeu2004 - 24 Jan 2008 00:54 GMT
> "joeu2004" <joeu2...@hotmail.com> wrote in message
> > Well you could do the following:
> > =datevalue(left(A1,find(" ",A1))) + timevalue(right(A1,len(A1)-find(" ",A1)))
>
> The Datevalue function does not convert the text "1/23/2008" yet it does
> convert "2008/1/23" [...]. Should I write some codes but I don't know VB
No need for UDF. What version of Excel are you using? In Office
Excel 2003, DATEVALUE() works with both forms of dates.
Anyway, looks like Dave finally offered a workable solution -- exactly
the one I would offer if the datevalue/timevalue did not work. Dave's
is simpler, relying on the exact format of the timestamp.