Excel Date Help

G

Guest

I am trying to write a formula that will change the date format. Here is what
I am trying to do. Can anyone help?

I would like the date to be in this format in cell F1, 19971219. This field
needs to have 8 digits for the complete date.

Cell A1 Contains the year, 1977
Cell B1 Contains the month, 12
Cell C1 Contains the day, 19

In this example we would have to append a leading zero on the month so it is
05 instead of just the 5. The same with the day it needs to have a leading 0
also.

Cell A1 Contains the year, 1977
Cell B1 Contains the month, 9
Cell C1 Contains the day, 5

I would like the date to be in this format in cell F1, 19970905

What is the best way to do this?

Thanks in advance.

Robert





Thanks
 
D

Dave Peterson

=date(a1,b1,c1)
and give it a nice format (yyyymmdd)

or if you want text:
=text(date(a1,b1,c1),"yyyymmdd")

The first will still be a date, so you can do all the date arithmetic you want.
The second will be text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top