A1 = 20090614
=--TEXT(A1,"0000\/00\/00")
The TEXT function returns a *text* representation of the referenced argument
in the format that you specify. The referenced argument in this case are
string of digits in cell A1 that represent a date in yyyy/mm/dd format.
So, we need to tell the TEXT function to convert that string of digits to
this date format yyyy/mm/dd. That's what all the 0s do. 0000/00/00. The \
slash is a delimiter that tells the function to separate the 0s into the
groups of 0000 00 00.
The result of the TEXT function is the *text value* "2009/06/14" which is
not a true Excel date even though it looks like one. Dates in Excel are
really just numbers formatted to look like dates. For example, if you enter
the current date in a cell, 7/9/2009, Excel automatically formats the cell
as Date and it looks like a date. However, the true underlying value of that
date is really the number 40003. To see this format that date cell as
General.
Now, since the result of the TEXT function is a text value we need to
convert that into a numeric number so that Excel will recognize it as a true
Excel date. One way to do that is to use the double unary "--". It will
convert the text string "2009/06/14" to the numeric value 40003 then you
apply the date format of your choice and end up with a true Excel date.