+ Reply to Thread
Results 1 to 8 of 8

Placing Date Portion First And Then Time From Given Data

  1. #1
    Registered User
    Join Date
    09-21-2018
    Location
    Saudi Arabia
    MS-Off Ver
    10
    Posts
    11

    Placing Date Portion First And Then Time From Given Data

    Hi,

    I have following date data received from a website. I collected these dates in Excel. Basically this is Immigration Entries at the airport that show a person has immigrated on so n so date and time. But airlines date format is typical like below.

    00:29:19*2008-12-25
    14:25:20*2009-09-17
    21:05:00*2011-12-26
    03:18:20*2014-01-17
    16:13:13*2016-09-26
    23:00:40*2017-03-11
    19:23:22*2018-04-26
    16:29:51*2018-11-10
    21:01:23*2021-04-28

    I need to appear this data in following manner so that I can utilize it for further process.

    Monday 15:23 20/08/2018 15:23
    Friday 14:16 19/02/2021 14:16
    Saturday 01:11 31/12/2022 01:11

    I want the date portion to appear first with / (not with - sign) and then time portion so I can display day and time of the entry in other column - as shown above.

    Is there any function or code to do it?

    Regards,
    Ashfaque Hussain

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,445

    Re: Placing Date Portion First And Then Time From Given Data

    Hi,

    To extract the date, use this..

    =DATEVALUE(RIGHT(A1,10))

    To extract the time, use this...

    =TIMEVALUE(LEFT(A1,8))

    Apply the required format from the ribbon: Home > Number > Select from drop down list
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2404-17531.20128
    Posts
    1,361

    Re: Placing Date Portion First And Then Time From Given Data

    If you are running Excel 365 then maybe the below, if you are not running 365 then the below should help anyway:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If things don't change they stay the same

  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
    44,607

    Re: Placing Date Portion First And Then Time From Given Data

    Similar approach, if you have 365:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This, as the previous solution, will output text values. If you want to be able to filter on the numeric date and time values, use this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and use a Custom format:
    Formula: copy to clipboard
    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
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Placing Date Portion First And Then Time From Given Data

    Or:

    =MID(A1&" "&A1,FIND("*",A1)+1,LEN(A1))+0

    then format however. you like.
    Remember what the dormouse said
    Feed your head

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

    Re: Placing Date Portion First And Then Time From Given Data

    Quote Originally Posted by CheeseSandwich View Post
    If you are running Excel 365 then maybe the below, if you are not running 365 then the below should help anyway:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I don't think that the OP wanted all that information in a single column of cells (I think the responses by 'sweep' and 'rorya' are more on the right track) BUT if he did, this much shorter formula would produce the same output as the formula you posted...
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Rick Rothstein; 02-27-2023 at 12:01 PM.

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

    Re: Placing Date Portion First And Then Time From Given Data

    Quote Originally Posted by rorya View Post
    =MID(A1&" "&A1,FIND("*",A1)+1,LEN(A1))+0

    then format however. you like.
    Since the format of the original data is fixed in size, your formula can be shortened to this...

    =0+MID(A1:A9&" "&A1:A9,10,19)

  8. #8
    Forum Expert CheeseSandwich's Avatar
    Join Date
    12-22-2021
    Location
    Kent, England
    MS-Off Ver
    365 - 2404-17531.20128
    Posts
    1,361

    Re: Placing Date Portion First And Then Time From Given Data

    Quote Originally Posted by Rick Rothstein View Post
    this much shorter formula would produce the same output as the formula you posted...
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thanks for that, i could have made it shorter but wanted to leave it so the OP could see how i had seperated each part as i did not know if the OP wanted a string or seperated values. A screenshot of the result would have made it clearer. The formula was created so as it could be broken down into segments and used that way, more like Sweep's approach.

+ 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. Date field and checking the Date portion of the date field not the time
    By badmullah in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-16-2022, 03:55 AM
  2. Moving a portion of data from one sheet to another based on date
    By vg05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2021, 08:57 AM
  3. [SOLVED] using vba get the serial number of time portion of date and time cell
    By jprlimey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-13-2020, 05:04 PM
  4. Replies: 1
    Last Post: 05-13-2015, 07:17 AM
  5. Remove time portion in date
    By angie.chang in forum Excel General
    Replies: 2
    Last Post: 06-13-2012, 12:19 AM
  6. comparing the time portion of a date/time
    By syphlix in forum Excel General
    Replies: 8
    Last Post: 03-25-2011, 04:08 AM
  7. Replies: 2
    Last Post: 12-06-2008, 02:41 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