Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel 2010 - Convert Improper Date to Proper Date

Posted on 2013-01-24
11
Medium Priority
?
1,124 Views
Last Modified: 2013-01-25
I have searched for Excel Date Converting, but all of the search results translates that to cell "Date" Formatting. It is nice to know how many methods of date cell formatting there are, but none of these methods solve my problem ...

I am frequently sent spreadsheets that have the Date as "20130124" and it is Formatted as "General"; re-formatting the cell as any Date Format yields "#############".

What can I do to convert the date from 20130124 to 01/24/2013, so I can use the "Short Date" Cell Format?
0
Comment
Question by:Frank Bryant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38815733
copy the column

then right click the column, select format, select the date format and what type you like

then paste the data back into column

hope that helps
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38815801
Use this formula and then format it as you want.
=DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))
0
 
LVL 13

Expert Comment

by:Shanan212
ID: 38815832
Insert a column next to it
Change "G14" with your cell where the wrong date is in

=LEFT(G14,4)&"/"&MID(G14,5,2)&"/"&RIGHT(G14,2)

Open in new window

0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
ID: 38815879
d2beetle,

"Text to Columns" can do this without a separate column...
(1) Select the cells containing the dates.
(2) On the Ribbon's Menu Bar, select Data and then "Text to Columns".
(3) Select the "Delimited" radio button (it's probably already selected).
(4) Click on "Next".
(5) Only the Tab delimiter checkbox should be selected.
(6) Click on the "Date" radio button and select "YMD" from the dropdown.
(7) Click on "Finish".

Regards,
Brian.
0
 

Author Comment

by:Frank Bryant
ID: 38816394
redmondbP,

Bingo! Thanks!

One more question, there are five other date columns in the spreadsheet that need the same conversion; is there some way to automate it via VBA/Macro?



Shanan212Po and ssaqibh

Thanks for the suggestion and it does work; however I do not want to add any more columns to the spreadsheet.



esskayb2dP,

I tried that and it did not work.
0
 
LVL 13

Assisted Solution

by:Shanan212
Shanan212 earned 500 total points
ID: 38816430
Doing it Brian's way,

Sub datemaker()
    Dim iRow As Long
    
    iRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(0, 0).Row
    
    Range("A2:A" & iRow).Select
    Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 5), TrailingMinusNumbers:=True
        
    Range("C2:C" & iRow).Select
    Selection.TextToColumns Destination:=Range("C2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 5), TrailingMinusNumbers:=True
        
    Range("F2:F" & iRow).Select
    Selection.TextToColumns Destination:=Range("F2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 5), TrailingMinusNumbers:=True
End Sub

Open in new window


To modify or add more columns, change one of these blocks (change the bold letters)

    Range("A2:A" & iRow).Select
    Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 5), TrailingMinusNumbers:=True
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38816498
Thanks, d2beetle.

Shanan212's macro looks excellent. (Trivial suggestion - the date will be wider than the original value, so it might be an idea to AutoFit the columns after the change.)

Regards,
Brian.
0
 
LVL 13

Expert Comment

by:Shanan212
ID: 38816514
Thanks Brian! It was your idea of cours :)

D2beetle,

Adding to that, this code will autofit. However you have to add/change columns below

   Range("A:A,C:C,F:F").Select
    Selection.Columns.AutoFit

Open in new window

0
 
LVL 26

Expert Comment

by:redmondb
ID: 38816627
... and your code, Shanan212!
0
 

Author Closing Comment

by:Frank Bryant
ID: 38818816
redmondb and Shanan212,

Thanks, :) points split evenly.
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38819084
Thanks, d2beetle!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

604 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