Results 1 to 4 of 4

Thread: Extract Time in 24H format from Date and time.

  1. #1
    Junior Member
    Join Date
    Aug 2016
    Posts
    12
    Rep Power
    0

    Extract Time in 24H format from Date and time.

    Please see the attached sheet, i need to calculate the no events in each shift

    Shift A - 8.31 PM - 4.30 AM
    Shift B - 4.31 AM - 12.30 PM
    Shift C - 12.31 PM - 8.30 PM
    Attached Files Attached Files

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    If you use the following formula in B2, you would get the Shift name/code.

    =LOOKUP(MOD(SUBSTITUTE(A2,",","",2),1),{0,4.5,12.5 ,20.5,24}/24,{"A","B","C","A","B"})

    OR

    =LOOKUP(--REPLACE(A2,1,14,""),{0,4.5,12.5,20.5,24}/24,{"A","B","C","A","B"})
    And you can use a pivot to get the count of events in each shift.
    Attached Files Attached Files
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Junior Member
    Join Date
    Aug 2016
    Posts
    12
    Rep Power
    0
    Perfect, thanks for all your help.

  4. #4
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    13
    or

    =MID("ABCA",MATCH(TIMEVALUE(MID(A2,15,12))*48,{0,9 ,25,41,48},1),1)

Similar Threads

  1. Extract Date and time from the Text Column
    By zorro in forum Excel Help
    Replies: 19
    Last Post: 09-17-2016, 10:16 AM
  2. Replies: 7
    Last Post: 08-25-2016, 04:14 PM
  3. Extract Time from a Date&time cell
    By Feebles in forum Excel Help
    Replies: 4
    Last Post: 11-09-2015, 06:24 AM
  4. Displayin Date/Time in "original" time zone
    By Rasm in forum Excel Help
    Replies: 4
    Last Post: 04-21-2012, 02:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •