Restrict data input to dates with the following format: YYYY-MM

Dear Experts:

I would like to restrict user input in cells A2:A30 to dates with the following format YYYY-MM.

Furthermore only dates between 2010-01 and 2030-12 are allowed.
Help is much appreciated. Thank you very much in advance.

Regards ,Andreas
Andreas HermleTeam leaderAsked:
Who is Participating?
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.

Farzad AkbarnejadDeveloperCommented:
Hello,
To define display format:

Right-click on the cell you want to restrict the format in
Choose "Format Cells"
In the "Numbers" tab (the one that it opens on), you will see a list of categories choose "Date"
On the right, you can choose different formats in which to have the date displayed
If you can't find a format that fits your need, choose "Custom" from the Categories list

Also you need to use Data Validation to force an input to a specific format.

    Excel 2007 (& likely 2010) - Data Tools group > Data Tab > Data Validation
    Excel 2003 and earlier - Data > Data Validation

Select Date and enter the restrictions and input/error messages (if any), users will then be guided to input in the correct format.

Regards,
-FA
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
Saqib Husain, SyedEngineerCommented:
Format the range with YYYY-MM
Apply data validation to the range with the Date option between the dates you specify
0
psteffCommented:
If (and only if) you want the numbers stored in that exact format for future reference and don’t really want them stored as a date, then you may need to build a huge table with all the options for the “dates”, and then through data validation restrict the input to the table you just built.  (Although I don’t know what the performance would be like though).
0
Andreas HermleTeam leaderAuthor Commented:
Dear all,

thank you very much for your great help. I really appreciate it. Regards, Andreas
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
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.