+ Reply to Thread
Results 1 to 7 of 7

Text to Date Formatting

  1. #1
    Registered User
    Join Date
    01-18-2011
    Location
    los angeles, ca
    MS-Off Ver
    Excel 2003
    Posts
    3

    Text to Date Formatting

    I have been trying to wrap my head around this one for a while.
    From To
    21016 10/16/2002
    21017 10/17/2002

    in other words
    ASDHK to SD/HK/200A

    This is a huge problem and I thank any contributors ahead of time.

  2. #2
    Registered User
    Join Date
    09-14-2004
    MS-Off Ver
    2010
    Posts
    30

    Re: Text to Date Formatting

    Using formulas, if your Data is in A1, you can type the following into A2:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Text to Date Formatting

    Hi and welcome to the board

    what happens if your string is for, say 1999 or 2010 ?

  4. #4
    Registered User
    Join Date
    01-18-2011
    Location
    los angeles, ca
    MS-Off Ver
    Excel 2003
    Posts
    3

    Smile Re: Text to Date Formatting

    Fizziii, you rock, that was a perfect answer to that problem,
    I have two more
    like arthurbr said, in my date convention a 1999 code is
    991031
    which would be converted to 10/31/1999
    another one of mine is
    1201
    which would need to be converted to 12/01/2001
    and 301
    which would be converted to 03/01/2001

    thanks again, Fizziii
    -slug

  5. #5
    Registered User
    Join Date
    01-18-2011
    Location
    los angeles, ca
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Text to Date Formatting

    Ok, so for the 1999 one:
    code:
    =MID(A1,3,2) & "/" & MID(A1,5,2) & "/19" & LEFT(A1,2)

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Text to Date Formatting

    if they are always 6 characters long use text to columns and select ymd option
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Text to Date Formatting

    Quote Originally Posted by slugowen - Examples

    21016 10/16/2002
    21017 10/17/2002
    991031 10/31/1999
    1201 12/01/2001
    301 03/01/2001
    There does not appear to be any consistency here - why for 2001 is the year digit omitted altogether ?

    It would seem from your examples detailed above that:

    Day is always 2 digits (leading zero)

    Month is either 1 or 2 digits (no leading zero)

    Year is either 2 digits (991031), 1 digit (21016) or 0 digits (301)
    If we assume that there's always a year digit (eg 1301 rather than 301) then there are obviously ambiguity issues, eg:

    11101 - could be either 11/01/2001 or 01/01/2011
    Could you confirm the above ?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1