+ Reply to Thread
Results 1 to 6 of 6

Splitting and Changing the format of a cell containing dates and times

  1. #1
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Splitting and Changing the format of a cell containing dates and times

    Hi,

    I download an excel document which has a column of dates and times in it, in the one cell.

    12-May-2021 11:58:53
    I needed to split this up into two different cells and did so using:
    =TRUNC(A1)
    for the date
    =MOD($F14,1)
    for the time

    I then compared the split date and time cells to two other cells containing the deadline date and time. A calculation then worked out if they were late (depending also on if the item was granted an extension). However the company has changed the format of the download document and as a result the the date/time format has changed as below:

    11 Nov 2021 - 10:00
    As a result the splitting of the cells don't work and neither does the calculation. Anyone any ideas how I can split this to get it to work again? Ive attached an example workbook with two dates in, one old style which works, one new one which doesnt. Any help much appreciated.
    Attached Files Attached Files
    Last edited by Barking_Mad; 01-05-2022 at 06:10 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Splitting and Changing the format of a cell containing dates and times

    G14, copied down:
    =LEFT(F14,11)+0

    H14, copied down:
    =ABS(LOOKUP(10^10,-RIGHT(F14,ROW($1:$100))))

    see file.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Splitting and Changing the format of a cell containing dates and times

    You can get the date with this (your titles seem in the wrong order):

    =DATE(MID(F14,8,4),(SEARCH(MID(F14,4,3),"JanFebMarAprMayJunJulAugSepOctNovDec")-1)/3+1,LEFT(F14,2))

    and the time with this:

    =TIMEVALUE(RIGHT(F14,LEN(F14)-FIND("-",F14)))

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Splitting and Changing the format of a cell containing dates and times

    Quote Originally Posted by Glenn Kennedy View Post
    G14, copied down:
    =LEFT(F14,11)+0

    H14, copied down:
    =ABS(LOOKUP(10^10,-RIGHT(F14,ROW($1:$100))))

    see file.
    You absolute legend! Cheers Glenn! reputation x 1000 to you

  5. #5
    Forum Contributor
    Join Date
    11-26-2008
    Location
    UK
    MS-Off Ver
    Using Excel 2019
    Posts
    317

    Re: Splitting and Changing the format of a cell containing dates and times

    Quote Originally Posted by Pete_UK View Post
    You can get the date with this (your titles seem in the wrong order):

    =DATE(MID(F14,8,4),(SEARCH(MID(F14,4,3),"JanFebMarAprMayJunJulAugSepOctNovDec")-1)/3+1,LEFT(F14,2))

    and the time with this:

    =TIMEVALUE(RIGHT(F14,LEN(F14)-FIND("-",F14)))

    Hope this helps.

    Pete
    Thanks Pete, that's most useful and well spotted

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Splitting and Changing the format of a cell containing dates and times

    You're welcome - thanks for the rep.

    Pete

+ 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] Excel Dates and Times in Number Format
    By doubleuson in forum Excel General
    Replies: 2
    Last Post: 11-10-2020, 10:03 AM
  2. Replies: 9
    Last Post: 04-14-2017, 05:21 AM
  3. VBA issue with dates - format is inconsistant and at times wrong
    By concatch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-24-2016, 05:22 AM
  4. Convert string dates and times to different format
    By excel12121 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2014, 02:39 PM
  5. Changing the dates format
    By vpande1 in forum Excel General
    Replies: 3
    Last Post: 07-21-2014, 06:32 AM
  6. Comparing dates & times from an export in mmm-dd yyyy hh:mm format
    By smilingrabbi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-15-2013, 11:51 AM
  7. Reversing and splitting dates and times
    By analystman in forum Excel General
    Replies: 1
    Last Post: 07-12-2011, 03:34 AM

Tags for this Thread

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