+ Reply to Thread
Results 1 to 6 of 6

Parsing text to Date & Time doesn't work

  1. #1
    Registered User
    Join Date
    04-10-2021
    Location
    USA
    MS-Off Ver
    365
    Posts
    8

    Parsing text to Date & Time doesn't work

    I need to parse text date and time values into real date and time

    This is what I'm doing:

    21.06.2021 20:25:43 =DATEVALUE(TEXT(A1,"DD.MM.YYYY")) + TIMEVALUE(TEXT(A1,"HH:MM"))

    I'm getting #VALUE! error

    Thakns.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Parsing text to Date & Time doesn't work

    Maybe:

    =DATEVALUE(TEXT(LEFT(A1,10),"DD.MM.YYYY")) + TIMEVALUE(TEXT(RIGHT(A1,7),"HH:MM"))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Parsing text to Date & Time doesn't work

    try

    date

    =DATEVALUE(SUBSTITUTE(MID($A$1,1,8),".","/"))

    format cell as required

    time

    =TIMEVALUE(MID($A$1,12,8)) or =TIMEVALUE(RIGHT($A$1,8))

    format cell as required


    =DATEVALUE(SUBSTITUTE(MID($A$1,1,8),".","/")) & =TIMEVALUE(MID($A$1,12,8))
    Last edited by JohnTopley; 04-07-2022 at 01:31 PM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Parsing text to Date & Time doesn't work

    Is your operating system set up to sue "." as the delimiter in short date format? Is it also setup to recognize DMY dates? Your profile says that you are in the US. I'm pretty sure the default US regional setting in windows is to use "/" and MDY for date formatting (mm/dd/yyyy maybe??). The DATEVALUE() function uses your system default when attempting to recognize text as date, so, if your operating system is set to use something else, Excel's DATEVALUE() function will not be able to recognize the date.

    The way I might approach this is to use Text to columns to split the text into four fields using "." as one delimiter and space as a second delimiter. Then recombine the numbers into the desired date/time serial number. With date, month, year separated into numbers and time stored as a number (my Text to columns automatically converted all field into numbers), you can recombine into a date/time serial number using DATE() and TIMEVALUE(). Assuming you parsed the text into A1:D1, then =DATE(C1,B1,A1)+D1 would work.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Registered User
    Join Date
    04-10-2021
    Location
    USA
    MS-Off Ver
    365
    Posts
    8

    Re: Parsing text to Date & Time doesn't work

    Thanks, this worked.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Parsing text to Date & Time doesn't work

    intuitive-reasoning, if that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Dave

+ 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: 06-18-2021, 11:39 AM
  2. Replies: 5
    Last Post: 02-19-2020, 05:12 AM
  3. [SOLVED] Date and time parsing from text string
    By MaximH in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-13-2019, 11:48 AM
  4. Replies: 10
    Last Post: 12-12-2016, 03:04 AM
  5. [SOLVED] CONCATENATE+TEXT+RANDBETWEEN+date format - doesn't work
    By sandy666 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-01-2015, 05:10 PM
  6. [SOLVED] Parsing Data that does not work with Text to Columns
    By jfinkel18 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-30-2013, 05:19 PM
  7. date - time parsing code
    By mgm in forum Excel General
    Replies: 1
    Last Post: 05-26-2005, 05:15 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