Solved

Need help formatting a Date in Excel

Posted on 2014-01-03
5
315 Views
Last Modified: 2014-01-27
Hi Experts,
I have a PostDate column on a spreadsheet that has the following format: 20121031

The first four characters are the year, characters 5 and 6 are for the month, and characters 7 and 8 are for the day value.

I need to create a new column that copies the values from the values in the PostDate column, but uses the following date format 10-31-2012.  How can i do this?  

Thanks in advance,
mrotor
0
Comment
Question by:mainrotor
5 Comments
 
LVL 26

Expert Comment

by:pony10us
ID: 39755154
Try this:

=CONCATENATE(MID(A1,5,2),"-",RIGHT(A1,2),"-",LEFT(A1,4))

Open in new window

0
 
LVL 18

Accepted Solution

by:
Steven Harris earned 500 total points
ID: 39755155
=CONCATENATE(MID(B4,5,2),"-",RIGHT(B4,2),"-",LEFT(B4,4))

Substitute B4 for the cell where the date is.

EDIT
They really need to have auto-refresh of pages for new posts...
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39755159
:)  true but at least you added the comment about substitution that I didn't have.
0
 
LVL 16

Expert Comment

by:Jerry Paladino
ID: 39755928
=DATEVALUE(MID(A1,5,2) & "-" & RIGHT(A1,2) & "-" & LEFT(A1,4))

Converts the text to an Excel serial date.     (41213 for 10-31-2012)

Then use Format/Cells/Number and pick the mm-dd-yyyy format for the cell(s).  Or any other date format that you might want.
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 39759068
Will your date string always be 8 characters?

What happens when you have a single digit month and/or single digit day?

Just a couple of points to consider.

Thanks
Rob H
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Outlook Free & Paid Tools
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now