+ Reply to Thread
Results 1 to 16 of 16

Change text date to normal date

  1. #1
    Registered User
    Join Date
    10-22-2014
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    21

    Change text date to normal date

    Hi,
    My name is Marc and I hope somebody can help me creating a VBA for my problem.
    I have included a file with the problem. See the Sheet Movies_seen.

    So in column “I” (Created) each cell has a date and time as a text string, it looks like this:
    Sun Aug 24 04:30:24 2014
    I want to replace this text date and time, into a normal date. This has to be in the same cell (sheet and column).

    For example: Sun Aug 24 04:30:24 2014 will look like: 24-8-2014 (first the day, then month and last the year, separated by a “-“.

    Only the date is of importance to me, the rest of the text and time of the cell can be ignored/deleted. The length of the column, in this example to row 89, is a variable.

    Hope my explanation is clear, if not feel free to contact me so I can explain some more.
    Thanks in advance for all your help.
    Marc
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,265

    Re: Change text date to normal date

    TimeValue and DateValue and Format functions.

  3. #3
    Registered User
    Join Date
    10-22-2014
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    21

    Re: Change text date to normal date

    Porucha verku,
    Thanks for your response but it's not entirely clear to me how I should use the functions: TimeValue and DateValue and Format in this case.
    Could you elaborate somewhat on this?
    Thanks!
    Marc

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,427

    Re: Change text date to normal date

    Try:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    10-12-2017
    Location
    Brazil
    MS-Off Ver
    2016
    Posts
    59

    Re: Change text date to normal date

    Hi.
    type in "J2):
    Please Login or Register  to view this content.
    and close with ctrl+shift+enter.
    Attached Files Attached Files
    Last edited by gfranco; 11-04-2017 at 05:22 PM.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,427

    Re: Change text date to normal date

    @gfranco: as far as I can see, a) that's not an array formula and b) it will always return 4 as the day of the month

  7. #7
    Registered User
    Join Date
    10-12-2017
    Location
    Brazil
    MS-Off Ver
    2016
    Posts
    59

    Re: Change text date to normal date

    Quote Originally Posted by TMS View Post
    @gfranco: as far as I can see, a) that's not an array formula and b) it will always return 4 as the day of the month
    You're right. I believe that the translation is not as faithful as the one automatically produced by excel.
    That's why I attached the spreadsheet.
    My excel is in Portuguese (Brazil). That's why I end up sending the worksheet instead of writing the formulas in the "codes".
    Do you understand my difficulty?

  8. #8
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,265

    Re: Change text date to normal date

    Quote Originally Posted by TMS View Post
    Try:

    Please Login or Register  to view this content.
    In non-english systems it fails because of others naming of months, month must be an integer.
    I propose, very similar:

    Please Login or Register  to view this content.
    Function 'Trim' habitually ...

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,427

    Re: Change text date to normal date

    @gfranco:
    Do you understand my difficulty?
    Yes, but my comments stand (I think )

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,427

    Re: Change text date to normal date

    In non-english systems it fails because of others naming of months, month must be an integer.
    I will have to take your word for that

  11. #11
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,265

    Re: Change text date to normal date

    Unfortunately, english "January" "in word" does not pass, as number yes - mp4 in zip (e.g. with mpc-hc player)
    So, "January and his eleven friends" no pasaran ... ...
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    10-12-2017
    Location
    Brazil
    MS-Off Ver
    2016
    Posts
    59

    Re: Change text date to normal date

    an array fórmula in my excel
    Attached Images Attached Images

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Change text date to normal date

    cramnij,
    Try and see how it goes.
    Please Login or Register  to view this content.

  14. #14
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,177

    Re: Change text date to normal date

    Or try:

    =--(TRIM(MID(I2;9;2))&MID(I2;5;3)&RIGHT(I2;5))

  15. #15
    Registered User
    Join Date
    10-22-2014
    Location
    Amsterdam
    MS-Off Ver
    2010
    Posts
    21

    Re: Change text date to normal date

    Thanks porucha vevrku,
    With some minor tweaks it works exactly as it supposed to do.
    To all the others also many thanks for your work and thoughts about this conundrum of mine.
    Marc

  16. #16
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,265

    Re: Change text date to normal date

    Thanks, but TMS's and jindon's solutions are also worth trying for you.
    TMS's for simplicity (small code length) and efficiency (but here only for english system configuration),
    and
    jindon's for "technical sophistication/advancement" of the code using regular expressions and effective although/though rarely used function ... real "Made in Japan" ...
    Use this because you have the opportunity to learn something new.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Change date format from text to date
    By maym in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-02-2017, 08:03 PM
  2. [SOLVED] Macro to change text date into normal date
    By mark888 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-20-2017, 03:59 AM
  3. Replies: 2
    Last Post: 01-31-2017, 10:00 PM
  4. [SOLVED] How to change text date (eg. July) to actual date format?
    By kellyfirth in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-10-2015, 09:49 AM
  5. Change text date 22OCT2013 to actual date
    By grattis in forum Excel General
    Replies: 14
    Last Post: 12-19-2013, 08:32 AM
  6. Replies: 3
    Last Post: 07-11-2009, 12:39 AM
  7. Change text to date and check against date in cell
    By RW in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2006, 11:30 AM

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