+ Reply to Thread
Results 1 to 17 of 17

Convert text date to real date

  1. #1
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Convert text date to real date

    This is a date in text format "Wednesday, July 1, 2018". How can I could convert it to real date? The result is 1/7/2018

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Convert text date to real date

    Try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Convert text date to real date

    Thanks. I got #VALUE# error.

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Convert text date to real date

    Does this formula work for you...

    =0+TRIM(SUBSTITUTE(MID(A1,FIND(" ",A1,FIND(" ",A1)+1),3),","," ")&MID(A1,FIND(" ",A1)+1,3)&RIGHT(A1,5))

  5. #5
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Convert text date to real date

    Thanks a lot Rick. That works. I got dash as delimeeter inside date. How could got / instead?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Convert text date to real date

    Quote Originally Posted by KingTamo View Post
    Thanks. I got #VALUE# error.
    It works for the sample you provided. Please attach your file for a more specific response.

    date.JPG

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Convert text date to real date

    @6StringJazzer,

    I've run into the problem with your solution myself. It seems that some "standard" date formats here in the US do not work at all overseas. My recollection is that the Month Day, Year format is one of those.



    @KingTamo,

    My code returns a real date so you can simply Custom Format the cell with the date format of your choosing.
    Last edited by Rick Rothstein; 06-22-2020 at 08:32 PM.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Convert text date to real date

    Quote Originally Posted by Rick Rothstein View Post
    I've run into the problem with your solution myself. It seems that some "standard" date formats here in the US do not work at all overseas. My recollection is that the Month Day, Year format is one of those.
    Thanks, I have had very limited experience in other localizations.

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Convert text date to real date

    Quote Originally Posted by 6StringJazzer View Post
    I have had very limited experience in other localizations.
    Me too which is why when I posted a formula in the past that outputted the date the way your formula did, I was told it did not work by that OP and someone else came along and informed me basically what I told you above.

  10. #10
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Convert text date to real date

    Thanks a lot Rick. It works well now. How can I use it in the macros section?

  11. #11
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Convert text date to real date

    Try integrating this into your code...
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Convert text date to real date

    I got a error at the last line of the code. Type mismatch.

  13. #13
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Convert text date to real date

    We are back to that problem with international date formats. Try replacing that line of code with this and see if that works...

    RealDate = CDate(Arr(2) & "-" & Arr(1) & "-" & Arr(3))

  14. #14
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Convert text date to real date

    Sorry but the same error.

  15. #15
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Convert text date to real date

    Okay, let's see if we can bypass VBA's attempt to form a date from a text string and do it the long way. Does this work for you...
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    11-24-2016
    Location
    Libya
    MS-Off Ver
    Office 365
    Posts
    526

    Re: Convert text date to real date

    Thanks a lot Rick sir. This solved the my problem.

  17. #17
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Convert text date to real date

    Great... I am glad we finally got this sorted out. I am going to save my solution in a file so I can reuse it should this or a similar question come up in this forum in the future.

+ 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. Replies: 2
    Last Post: 05-15-2019, 03:24 PM
  2. text date into real date
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 10-19-2018, 09:08 AM
  3. Converting text date into real date
    By ammartino44 in forum Excel General
    Replies: 4
    Last Post: 03-06-2018, 04:22 AM
  4. [SOLVED] convert text date/time into a real date
    By sabha in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 09-23-2017, 02:34 PM
  5. Convert text in multiple columns to real date and time
    By ken444444 in forum Excel General
    Replies: 4
    Last Post: 10-06-2014, 01:19 PM
  6. Macro to enter a date without the "/" and convert it to a real date entry
    By Argile79 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-14-2010, 05:12 PM
  7. Help: How do I convert a text date into a real date format
    By japorms in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-02-2006, 01:36 PM

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