It's not the cell's format that makes a difference.
It's a windows regional setting. If your windows short date--nothing
inside
excel--is in mdy format, it'll work.
If you select an empty cell and hit ctrl-; (control semicolon), what do
you
see? What order is the date in the formulabar?
You can parse that value into its pieces and convert it to a date:
=DATE(MID(A1,7,4),LEFT(A1,2),MID(A1,4,2))--RIGHT(A1,8)
You could put that in a helper cell or just use it as part of your
formula.
=DATE(MID(A1,7,4),LEFT(A1,2),MID(A1,4,2))--RIGHT(A1,8) - now()
and give it a nice format
(where a1 contains your text string)
Hi Dave,
I formated the cell as mdy format, then did the subtraction and end up
#VALUE!. When I looked into the step in calculation, Excel showed that it
was the text string "01/23/2008 16:01:00" which caused #VALUE!.
i.e. now()- "01/23/2008 16:01:00"
Any function to convert the string?
Dave Peterson said:
I didn't say you should convert it to text, I said that if your short
date
format was mdy, then excel would do it when it did the subtraction.
Did you try it?
Derek wrote:
Hi Dave,
Thank you for your input.
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?
Derek
If your windows shortdate is in mdy order, then subtract the smaller
from
the
larger (excel will coerce the text time/date to a number) and format
the
cell
the way you like:
Maybe
[hh]:mm:ss
or
d hh:mm:ss
Derek wrote:
Hi,
I have a price quote with a timestamp which is returned from the
server.
The
timestamp is in text with format 01/23/2008 16:01:00.
Can anybody help me to compare the timestamp with now() so that the
closing
price can be identified?