+ Reply to Thread
Results 1 to 7 of 7

Convert MMDDYY to MM/DD/YY?

  1. #1
    Registered User
    Join Date
    03-05-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Convert MMDDYY to MM/DD/YY?

    I want to be able to type 030511 (or 03052011 if necessary) in a cell and have the cell next to it display 03/05/2011. Is this possible?

  2. #2
    Registered User
    Join Date
    03-05-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Can I convert MMDDYY to MM/DD/YY?

    I figured it out. =IF(A2=0," ",LEFT(A2,2)&"/"&MID(A2,3,2)&"/20"&MID(A2,5,2))

  3. #3
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Can I convert MMDDYY to MM/DD/YY?

    hi,

    Welcome to the Forum

    edit: nice one - I like it when I get beaten to the answer by the poster
    end edit

    Yes, this is possible. Here are three options:
    This will give a text string:
    =IF(LEN(A1)=5,LEFT(A1,1)&"/"&MID(A1,2,2)&"/20"&RIGHT(A1,2),IF(LEN(A1)=6,LEFT(A1,2)&"/"&MID(A1,4,2)&"/20"&RIGHT(A1,2),"please check your entry"))
    This will return a date value that you can format as desired:
    =DATEVALUE(IF(LEN(A1)=5,LEFT(A1,1)&"/"&MID(A1,2,2)&"/20"&RIGHT(A1,2),IF(LEN(A1)=6,LEFT(A1,2)&"/"&MID(A1,4,2)&"/20"&RIGHT(A1,2),"please check your entry")))

    or
    =IF(LEN(A1)=5,DATE(2000+RIGHT(A1,2),MID(A1,2,2),LEFT(A1,1)),IF(LEN(A1)=6,DATE(2000+RIGHT(A1,2),MID(A1,3,2),LEFT(A1,1)),"please check your entry"))

    I'm sure these formulae could be written more eloquently, but I think they will do what you want.

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Can I convert MMDDYY to MM/DD/YY?

    First, format Col_A as TEXT.
    Then, try this:
    Please Login or Register  to view this content.


    Please Login or Register  to view this content.

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Registered User
    Join Date
    03-05-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Can I convert MMDDYY to MM/DD/YY?

    Yes, thanks a lot guys, but now I have another modification I need. If the last 2 numbers are greater than 70, I want it to insert 19 instead of 20. And if the last 2 numbers are less than 70, to insert 20. E.g. 081578 would be 08/15/1978 and 081533 would be 08/15/2033. Or if there is an easier way of doing it, that would be great too. Thanks again by the way.

  6. #6
    Forum Contributor
    Join Date
    12-02-2004
    Location
    London
    Posts
    255

    Re: Convert MMDDYY to MM/DD/YY?

    Try the following as an amendment to your original formula:-

    =IF(A2=0," ",LEFT(A2,2)&"/"&MID(A2,3,2)&IF(VALUE(RIGHT(A2,2))<70,"/20","/19")&MID(A2,5,2))

  7. #7
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Can I convert MMDDYY to MM/DD/YY?

    As long as the inputs only use 2-digit years, would you consider letting Excel decide which century the date belongs in?

    Try this:
    A1: some date text...
    Examples:
    081578
    012731
    091229

    Please Login or Register  to view this content.


    In the above examples, the formula would return these values:
    08/15/1978
    01/27/1931
    09/12/2029

    Is that something you can work with?

+ 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