mainrotor
asked on
Need help formatting a Date in Excel
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:) true but at least you added the comment about substitution that I didn't have.
=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.
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.
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
What happens when you have a single digit month and/or single digit day?
Just a couple of points to consider.
Thanks
Rob H
Open in new window