Stan Brown said:
Indeed, that works, but why? I thought all dates and times were
stored internally as real numbers.
I thought that as well. I have written many times in these NG's that dates
are just numbers formatted to look like numbers and so far no one has ever
corrected me but I am now having doubts if it is that simple.
I am sure that it was Dave Peterson who once said in answering one of my
posts *Dates are funny*
Certainly they seem to be treated differently by XL to all other entries.
If I enter 39452 in a cell and format it as Accounting I see £39,452.00 in
the cell but still simply 39452 in the formula bar. If I format the cell as
a date I see 5 Jan 2008 in the cell and 05/01/2008 in the formula bar. So I
am not simply seeing in the formula bar the number formatted to look like a
date by the formatting I applied or the number that I enter. It is almost
as if XL has changed the number into a string - well a funny sort of string
anyway - and applied the formatting to that. If this is what is really
being stored in the cell then it explains why the replacement works but XL
must then re-interpret the *string* back into a number whenever a formula
uses it.
As Dave said, "Dates are funny"
--
HTH
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk