+ Reply to Thread
Results 1 to 10 of 10

date format from yyyy-mm to mm-dd-yyyy

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    date format from yyyy-mm to mm-dd-yyyy

    I have an excel file that has every record in a particular column displayed as yyyy-mm e.g. 2008-01 for Jan 2008
    I need to convert that to 01-01-2008 or 1/1/2008
    None of the records have a day included in the record but I want to set them all to the first day of the month.
    The data goes back to 2006 and there are thousands of records.

    Any ideas on the easiest way to make this change to the data? I will get a similar file every month and will need to make the change.

    Thanks for any help.

    Slash

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: date format from yyyy-mm to mm-dd-yyyy

    tryy this formula, and let me know how you make out...
    =DATE(LEFT(M6,4),RIGHT(M6,2),1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: date format from yyyy-mm to mm-dd-yyyy

    Thanks. It worked perfectly.
    I had to add a column and then put that formula in the column to display the correct date.

    After I make the update to the file, I export it to a cvs file. The original date column stays in the cvs file even when I hide the column in excel.
    Is there a way to change the original column or delete the old column without changing the new column and records?

    My work around is the export the file as a CVS and then open it in excel and delete the original 2008-01 column and then re-save.

    I'd like to eliminate that step.

    Any ideas?

    Thx

    Slash.

  4. #4
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: date format from yyyy-mm to mm-dd-yyyy

    How would I modify the formula to format Jan-11 to 1/1/2011?

    Thx

    Slash

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: date format from yyyy-mm to mm-dd-yyyy

    try this...=DATEVALUE(RIGHT(A1,2)&"-"&LEFT(A1,3))

  6. #6
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: date format from yyyy-mm to mm-dd-yyyy

    I get the following error.
    A value used in the formula is of the wrong data type.
    Any ideas?

    The field I'm attempting to convert has the following in it:
    Jan-11

    Thx again.

    Slash

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: date format from yyyy-mm to mm-dd-yyyy

    is you Jan-11 actually a date, or is it text? test with =ISNUMBER(CELL)

    maybe you could upload a sample for me to look at?

  8. #8
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: date format from yyyy-mm to mm-dd-yyyy

    It seems to be a date field and when I click on the cell it says 1/14/2011.
    I need the date to default to the 1st day of the month. e.g. 1/1/2011

    I attached an excel file with 2 rows. I attempted to add your formula but I'm receiving an error.

    Thx for your help.

    Slash.
    Attached Files Attached Files

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: date format from yyyy-mm to mm-dd-yyyy

    ok 2 things. 1st, that IS a date, and it has a value of 1/14/2011
    2nd, you were referencing C1 when the value was in C2

    try this..
    =DATE(YEAR(C2),MONTH(C2),1)

  10. #10
    Registered User
    Join Date
    09-26-2012
    Location
    San Diego California
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: date format from yyyy-mm to mm-dd-yyyy

    Ok. This worked for me.
    =MONTH(D2)&"/"&1&"/"&YEAR(D2)

    Thanks for all your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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