Convert Excel date to the same number

I have an Excel file with one column of DATE format field. I want to convert this to a number but keep the same data. for example 20110101 should stay as 20100101 (as a NUMBER format) instead of 40179 that Excel converts it to if I do a change format.
gmollineauAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

als315Commented:
If yor cell with date is A1, you can use:
=YEAR(A1)*10000+MONTH(A1)*100+DAY(A1)
0
barry houdiniCommented:
This should also do it....

=TEXT(A1,"yyyymmdd")+0

regards, barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gašper KamenšekExcel MVPCommented:
The correct way would actually be to press Ctrl+1 ( or right click and choose Format cells) go to custom format, and write yyyymmdd or yyyyddmm which ever you prefer.
With this you achieve precisely what you want. You still have the same data, but in the format you desire.
Best of  luck.
0
barry houdiniCommented:
.....I think that's exactly what gmollineau is trying to avoid GasperK. If you do that then the format only is changed (not the cell contents) and if you change the format to general you'll see a number like 40179.

My suggestion and the suggestion of als315 both use an extra cell to do the conversion, you can only change the cell content "in situ" if you use VBA.

regards, barry
0
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.