+ Reply to Thread
Results 1 to 13 of 13

Complicated date format.

  1. #1
    Registered User
    Join Date
    09-23-2011
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Complicated date format.

    Hi all.

    I'm working from an irritating import that seems to be protected in every way possible. The date is supplied as 17.07.1985
    So far I've been unable to manipulate it in any way shape or form.

    I need it to be 1985/07/17 or 1985.07.17 - I just need the year first.

    I've tried reversing the characters but that of course doesn't work as my version does a character at a time.

    I've used a replace function on the cell already to replace the dots with slashes but this is not required and can be removed.

    Can anyone suggest a way please? In java I would use a substring and seperate the text from the "/" etc but I don't know how to do it in excel.

    Could anyone help?

    Many thanks!

    Steve

  2. #2
    Forum Contributor Russell Dawson's Avatar
    Join Date
    03-01-2012
    Location
    Yorkshire, England
    MS-Off Ver
    2007
    Posts
    608

    Re: Complicated date format.

    Hi Steve,

    I don't understand you when you say:

    I've used a replace function on the cell already to replace the dots with slashes but this is not required and can be removed.
    Because you do say that you want it to appear as 1985/07/17.

    Although I'm working with 2007 I'm pretty sure 2003 has the same functionality to do this. Use replace to substitute the dots with slashes and custom format as yyyy/mm/dd

    Cheers

    Russell
    If I helped, please don't forget to add to my reputation. (click on the star below the post)

    If the problem is solved, please: Select Thread Tools (on top of your 1st post) -> Mark this thread as Solved.

    Failure is not falling down but refusing to get up.

  3. #3
    Registered User
    Join Date
    09-23-2011
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Complicated date format.

    Hi Russell, I did originally want it to have "/"'s in but thats no longer a requirement.

    I've tried to format the cells and still no joy. the bizarre thing is when I copy and paste only the values into another cell...I still can't format it or custom format it etc. it's set in stone. I've not come across this issue before.

  4. #4
    Registered User
    Join Date
    09-23-2011
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Complicated date format.

    Just to make things clearer.

    I have: 29.12.2012

    I then used =REPLACE(REPLACE(M16,3,1,"/"),6,1,"/") to get 29/12/2012.

    From this point on I can no longer manipulate the format of the cell to make the year first.

  5. #5
    Forum Contributor Russell Dawson's Avatar
    Join Date
    03-01-2012
    Location
    Yorkshire, England
    MS-Off Ver
    2007
    Posts
    608

    Re: Complicated date format.

    Rather than using the replace formula have you tried the Replace function?

    http://support.microsoft.com/kb/288291

  6. #6
    Registered User
    Join Date
    09-23-2011
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Complicated date format.

    I'm now working ona very ugly solution but having issues.

    =RIGHT(LEFT(H65,7)&RIGHT(LEFT(H65,8))&RIGHT(LEFT(H65,9))&RIGHT(LEFT(H65,10))&RIGHT(LEFT(H65,6))&RIGHT(LEFT(H65,4))&RIGHT(LEFT(H65,5))&RIGHT(LEFT(H65,3))&RIGHT(LEFT(H65,1))&RIGHT(LEFT(H65,2)),LEN(H65))

    this is generating .03.22

    I'm getting there. I think there is a lot of white space at the end of the year so may need to trim first?

    from left to right

    data:2 2 . 0 3 . 1 9 8 2
    char:1 2 3 4 5 6 7 8 9 10

    sequence reqd:
    7 8 9 10 | 6 | 4 5 | 3 | 1 2

  7. #7
    Forum Contributor Russell Dawson's Avatar
    Join Date
    03-01-2012
    Location
    Yorkshire, England
    MS-Off Ver
    2007
    Posts
    608

    Re: Complicated date format.

    Could you upload a sample of what you are faced with at the start?

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

    Re: Complicated date format.

    once you use replace or substitute it becomes text so you have to change it back to a number

    =--SUBSTITUTE(A1,".","/")
    mind you find . replace / should have worked
    so should select column then data /text to columns,
    click next
    click next again
    choose dmy from the options click finish
    "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

  9. #9
    Registered User
    Join Date
    09-23-2011
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Complicated date format.

    SUCCESS!!!

    =TRIM(H64)

    =RIGHT(LEFT(I64,7)&RIGHT(LEFT(I64,8))&RIGHT(LEFT(I64,9))&RIGHT(LEFT(I64,10))&RIGHT(LEFT(I64,6))&RIGHT(LEFT(I64,4))&RIGHT(LEFT(I64,5))&RIGHT(LEFT(I64,3))&RIGHT(LEFT(I64,1))&RIGHT(LEFT(I64,2)),LEN(I64))

    =REPLACE(REPLACE(J64,5,1,"/"),8,1,"/")

    Gives me the right result!!!

    Now...can I put all of that in one cell?

  10. #10
    Registered User
    Join Date
    09-23-2011
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Complicated date format.

    Hi Martin,

    Thanks for having a peek but that didn't work either

  11. #11
    Forum Contributor Russell Dawson's Avatar
    Join Date
    03-01-2012
    Location
    Yorkshire, England
    MS-Off Ver
    2007
    Posts
    608

    Re: Complicated date format.

    I can't understand why my suggestion doesn't work for you. So simple and no additional columns required. Or am I missing something? No worries.

  12. #12
    Registered User
    Join Date
    09-23-2011
    Location
    Norwich, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Complicated date format.

    I wish I knew but thank you for the help!!!

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

    Re: Complicated date format.

    i still thinkyou should upload a sample that formula seems pretty excessive!

+ 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