Formatting a column of numbers as a date

Below is an example of dates I have in a spreadsheet, the dates are stored as a number. It's MMDDYYYY format with no leading zeros.  How can I convert this to a proper date that excel can recognize?

From Date
2022017
2022017
2022017
2262017
2212017
2152017
2242017
2022017
2172017
2142017
2172017
2192017
2242017
2262017
2022017
2252017
2252017
2282017
2062017
2022017
2102017
2262017
LVL 1
roosterupAsked:
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.

ShumsExcel & VBA ExpertCommented:
Hi,

Assuming your date series starts from A2, enter below formula in B2 and drag down:
=DATE(RIGHT(A2,4),LEFT(A2,1),MID(A2,2,2))

Open in new window

Select Col B and change the date format accordingly:
Convert Text To Date

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
NorieAnalyst Assistant Commented:
  1. Select the column of 'dates'.
  2. Goto Data>Text to columns...,
  3. Select Delimited and on the 3rd step select YMD from the Column data format dropdown.
roosterupAuthor Commented:
Norie this didn't seem to work. the values are currently stored as numbers. I ran through the steps and nothing seemed to happen.
ShumsExcel & VBA ExpertCommented:
Have you tried my solution?
Rob HensonFinance AnalystCommented:
The accepted solution works with single digit months. What about 2 digit months (October to December)?

Slight amendment:

=DATE(RIGHT(A2,4),LEFT(A2,IF(LEN(A2)=8,2,1)),MID(A2,IF(LEN(A2)=8,3,2),2))

or alternative method:

=DATE(RIGHT(A2,4),INT(A2/10^6),INT((A2-FLOOR(A2,10^6))/10^4))

With your number the millions (10^6) will represent the month, the 10 thousands (10^4) will represent the day and then the thousands (right end 4) are year.
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
Microsoft Office

From novice to tech pro — start learning today.