+ Reply to Thread
Results 1 to 8 of 8

Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-06"

  1. #1
    Registered User
    Join Date
    12-27-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-06"

    Hi,

    I have this problem:

    I have dates in this format "from Friday 4 to Sunday 6 January 2013"

    and I need to transform it in the following format:

    "2013-01-04" in one column
    "2013-01-06" in another column

    Many thanks in advance for your precious help!

    Sarah

  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,933

    Re: Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-0

    the "from Friday 4 to Sunday 6 January 2013" is all in 1 cell?
    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
    12-27-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-0

    Hi,

    yes it is in 1 cell.

    many thanks
    Sarah

  4. #4
    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,933

    Re: Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-0

    assuming the data is in A1, in B1 use this...
    =DATEVALUE(MID(A1,SEARCH(" ",A1,SEARCH(" ",A1,1)+1)+1,2)&" "&MID(A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,1)+1)+1)+1)+1)+2,LEN(A1)-5))
    and in C1 use this...
    =DATEVALUE(MID(A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,1)+1)+1)+1)+1)+1,2)&" "&MID(A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,SEARCH(" ",A1,1)+1)+1)+1)+1)+2,LEN(A1)-5))

    format custom YYYY-MM-DD

  5. #5
    Registered User
    Join Date
    12-27-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-0

    Many thanks for the formulas,

    I have tried them and it gives me an error signal.

    Could you please verify there are not ";" missing?

    Many thanks

    Sarah

  6. #6
    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,933

    Re: Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-0

    it worked find on my side. it may be a regional thing, in which case you will need to change all the , to ;

    to test that, type in any function that needs a criteria, eg vlookup() , and see if it uses , or ; to separate things

    If that still doesnt work, perhaps it would be easier to help you if you uploaded a sample workbook, showing what data you are working with, a few examples of what your expected outcome would be, and how you would arrive at that (remove any confidential info if necessary).

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  7. #7
    Registered User
    Join Date
    12-27-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-0

    Thank you I'll try to change the "," with ";" and tomorrow I will get back to you as I need to go out from the office.

    thanks!
    Sarah

  8. #8
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Transform date from "from Friday 4 to Sunday 6 January" to "2013-01-04" and "2013-01-0

    A1: from Friday 4 to Sunday 6 January 2013

    Formula:

    B1: =TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",99)),198,99)&RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),198))+0

    C1: =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),297))+0

+ 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