Converting Numbers to Date Format

sinkintome812

New Member
Joined
Sep 14, 2017
Messages
2
So for work, I have an excel spreadsheet that I use to keep track of documents I send out for specific patients I deal with. Some of the columns are dates that are always changing. I'm wondering if anyone knows a way to format the cells so that I don't have to type in the full date?

For example:

If I were to type in 42217, in the same cell it would automatically change it to 04/22/17.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
So for work, I have an excel spreadsheet that I use to keep track of documents I send out for specific patients I deal with. Some of the columns are dates that are always changing. I'm wondering if anyone knows a way to format the cells so that I don't have to type in the full date?

For example:

If I were to type in 42217, in the same cell it would automatically change it to 04/22/17.
You could use Cell Formatting to do it BUT that would only make the cell look like a date, but the value in the cell would still be the non-date number 42217. The only way to so what you want is to use VBA event code. Is that something you could use? If so, we would need to lock down what range of cells to apply the event code to.
 
Upvote 0
The VBA code is something I can do, I'm familiar with using macros. Now if I do use the Cell Formatting to do it, having the actual cell value being a non-date would I be able to sort the column by date?
 
Upvote 0
Now if I do use the Cell Formatting to do it, having the actual cell value being a non-date would I be able to sort the column by date?

That depends. Will you ever have more than one year? If so, then no. But the number format you would use would be something like:

00"/"00"/"00

You could always have a helper column that you use to sort on that would have a formula like:

=DATEVALUE(TEXT(A1,"00""/""00""/""00"))

Having said that, be aware that if you go for this option you will ALWAYS need to enter the day as two digits, you cannot shortcut november 1st as 11117 since this solution will interpret that to be january 11th.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,714
Members
449,118
Latest member
MichealRed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top