Thread
:
Converting 8 digit numbers into dates
View Single Post
#
5
Posted to microsoft.public.excel.misc
[email protected]
external usenet poster
Posts: 4
Converting 8 digit numbers into dates
I thought about that, but it's a task that will be repeated, and I
don't want to go through the burden of putting extra columns in and
then deleting them every time I need to do this conversion.
Thanks
Andy
Pete_UK wrote:
Why not just use a formula? If your dates start in A1, enter this in
B1:
=VALUE(RIGHT(A1,2)&"/"&MID(A1,5,2)&"/"&LEFT(A1,4))
Format the cell as a date and copy down. You could fix the values in
column B and then delete the originals in column A.
Hope this helps.
Pete
wrote:
Hi,
I have a spreadsheet with 1800 dates in one column. However, Excel
doesn't recognise them as a date. Why? Because they are in the
following format:
20050512
Which I know is yyyymmdd.
However, I cannot work out a way to convert these, in a macro, to
something that Excel recognises as a UK date (dd/mm/yyyy).
I've writtne a macro that rearranges the numbers, but the new data
doesn't recognise amiguous US/UK dates properly (ie is 20050512 the
fifth of December or the twelfth of May?):
Sub ChangeDate()
For Each c In Range("A2:A1801").Cells
' For each cell, re-arrange the numbers - last 2 digits, middle 2
and first 4, putting in a "/" between them
c.Value = Right(c.Value, 2) & "/" & Mid(c.Value, 5, 2) & "/" &
Left(c.Value, 4)
Next
Any help much appreciated....
Reply With Quote
[email protected]
View Public Profile
Find all posts by
[email protected]