+ Reply to Thread
Results 1 to 5 of 5

Having trouble with date & time formula due to formatting

  1. #1
    Registered User
    Join Date
    10-25-2019
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    3

    Having trouble with date & time formula due to formatting

    I need to be able to calculate the number of hours between two entries, but the PM/AM doesn't have a space before it so the formulas for date/time difference aren't calculating. Here is what the entries look like and ultimately I need the duration between the two even when it crosses midnight:

    Actual Start Time Actual End Time
    3/26/2018 3:54PM 3/26/2018 9:48PM

    I've tried the left/right formula to add the space between the minutes and PM/AM but since the date is m/d/yyyy it's not always the same number of spaces to the left.

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Having trouble with date & time formula due to formatting

    a few options, one:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where A3 holds start, and B3 end.

  3. #3
    Registered User
    Join Date
    10-25-2019
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    3

    Re: Having trouble with date & time formula due to formatting

    Attachment 646777

    I think this is what will work because the formatting is the issue

    =CONCATENATE(TEXT(LEFT(A2,FIND(" ",A2,1)-1),"mm/dd/yyyy")," ",TEXT(TRIM(MID(LEFT(A2,LEN(A2)-2),SEARCH(" ",LEFT(A2,LEN(A2)-2)),LEN(LEFT(A2,LEN(A2)-2)))),"hh:mm")," ",RIGHT(A2,2))

  4. #4
    Registered User
    Join Date
    10-25-2019
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    3

    Re: Having trouble with date & time formula due to formatting

    Thank you so much!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,432

    Re: Having trouble with date & time formula due to formatting

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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] Date formatting trouble
    By Alex222 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-07-2019, 02:14 PM
  2. IF Statement Trouble with DATE and TIME - Employee Attendance
    By jclaborn in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-26-2018, 03:57 AM
  3. Trouble with date formatting
    By Arismac in forum Excel General
    Replies: 2
    Last Post: 07-08-2015, 10:52 PM
  4. Conditional Formatting Formula - Date & Time for intervals
    By jamesfxd in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-08-2015, 12:23 AM
  5. Trouble formatting date
    By geordy67 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-26-2006, 09:35 PM
  6. [SOLVED] Trouble formatting Date data
    By LB in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-01-2006, 07:15 AM
  7. Trouble with OpenText() and Date/Time Values
    By rmac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2006, 11:35 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