Change Time into Military

2

Answers

  • Sorry - here you go! Meant to add that too!

    =((VALUE(LEFT([Sunday Close Military Time]1, 2)) + VALUE(RIGHT([Sunday Close Military Time]1, 2)) / 60) - (VALUE(LEFT([Sun Open Military Time]1, 2)) + VALUE(RIGHT([Sun Open Military Time]1, 2)) / 60))

  • Perfection!! Thank you so much @Paul Newcome - that worked! Appreciate everyone's help here. Saved me hours of muddling around.

  • Another question on the same string... @Paul Newcome maybe you can help? We are now allowing 12:00am in the Sunday close and it messes with my formula.

    Here's the formula and an example: =VALUE((VALUE(LEFT([Sun Close]1, FIND(":", [Sun Close]1) - 1)) - IF(VALUE(LEFT([Sun Close]1, FIND(":", [Sun Close]1) - 1)) = 12, 12, 0) + IF(RIGHT([Sun Close]1, 2) = "pm", 12, 0)) + MID([Sun Close]1, FIND(":", [Sun Close]1) + 1, 2))


    At first, I thought maybe I'd be tricky and change the "pm" to "am" and put 24 within the formula - works with 12:00am, but that causes everything else to be wrong (see first row Sunday Close). If I use the formula above, it returns 0 for Midnight. I can always change the selection to "Midnight" if that would be easier to just add that into the statement vs. numbers.


    Any help is appreciated.

  • @Paul Newcome THANK YOU!! I ended up only changing my current statement on the Close column from:

    =VALUE((VALUE(LEFT([Sun Close]1, FIND(":", [Sun Close]1) - 1)) - IF(VALUE(LEFT([Sun Close]1, FIND(":", [Sun Close]1) - 1)) = 12, 12, 0) + IF(RIGHT([Sun Close]1, 2) = "pm", 12, 0)) + MID([Sun Close]1, FIND(":", [Sun Close]1) + 1, 2))

    to

    =IF([Sun Close]1 = "12:00 am", 2400, VALUE((VALUE(LEFT([Sun Close]1, FIND(":", [Sun Close]1) - 1)) - IF(VALUE(LEFT([Sun Close]1, FIND(":", [Sun Close]1) - 1)) = 12, 12, 0) + IF(RIGHT([Sun Close]1, 2) = "pm", 12, 0)) + MID([Sun Close]1, FIND(":", [Sun Close]1) + 1, 2)))


    And that seems to have worked without touching the open column (we aren't changing any times there).

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Happy to help. 👍️


    Are you only using whole hours? I ask because your current setup may not provide accurate results in certain circumstances if you had times such as 1:23 am or 4:30 pm where the minutes are not "00".

  • We are using set values but only whole and half (like 4pm and 430pm). It seems to still work and I've tried all sorts of variables.

    Data sets are open: 7:00 am, 7:30 am, 8:00 am, 8:30 am, 9:00 am, 9:30 am, 10:00 am, 10:30 am, 11:00 am, 11:30 am, 12:00 pm, 12:30 pm, 1:00 pm

    And closed: 4:00 pm, 4:30 pm, 5:00 pm, 5:30 pm, 6:00 pm, 6:30 pm, 7:00 pm, 7:30 pm, 8:00 pm, 8:30 pm, 9:00 pm, 9:30 pm, 10:00 pm, 10:30 pm, 11:00 pm, 11:30 pm, 12:00 am

  • And remember it needs to show military time.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    I just went back through the thread and saw your post with the actual calculation. I was looking at your open and close conversion formulas and didn't see anything where you were dividing or multiplying by 60 to convert minutes to hours for the decimal portion, but I see now that you are doing that in your final calculation. Sorry about that.

  • NOOO problem at all - you have been sooo amazing and I appreciate it!! I couldn't do it without YOU!! And, everyone else in this community!

  • I'm trying to find the duration and the formula I'm using is correct but for times like "900" I'm getting a negative number. How can I implement this same thing but in the formula I'm using?

    =(VALUE(LEFT([End Military]@row, 2)) + VALUE(RIGHT([End Military]@row, 2)) / 60) - (VALUE(LEFT([Start Military]@row, 2)) + VALUE(RIGHT([Start Military]@row, 2)) / 60)

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @Adrian Garcia You would implement it the same way. The IF/LEN would go in the second portion of the LEFT functions to tell them to pull either one or two digits based on the overall character count.


    So instead of

    LEFT(Time@row, 1)

    you would have

    LEFT(Time@row, IF(LEN(Time@row) = 3, 1, 2))