Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-27-2022, 04:05 AM
cwkotch cwkotch is offline Another Military Time conundrum Windows 10 Another Military Time conundrum Office 2019
Novice
Another Military Time conundrum
 
Join Date: Oct 2015
Posts: 15
cwkotch is on a distinguished road
Default Another Military Time conundrum


I'm trying to use excel to track my work hours in Military time...however, if my time on duty is greater (in value) than my off duty time, the calculation is boogered up. Example.. I'm on duty at 22:00, and off at 06:00, the time worked is always added, no matter the operator I use, + or -. I've done some forum searching but none seem to address this specific issue.
Reply With Quote
  #2  
Old 07-27-2022, 08:54 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Another Military Time conundrum Windows 7 64bit Another Military Time conundrum Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,770
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Quote:
the time worked is always added, no matter the operator I use, + or -.
Could you please be more explicit?
What are you trying to achieve?
Perhaps post a small ampls sheet ( no pics please) with some data and expected results?
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #3  
Old 07-27-2022, 09:39 AM
cwkotch cwkotch is offline Another Military Time conundrum Windows 10 Another Military Time conundrum Office 2019
Novice
Another Military Time conundrum
 
Join Date: Oct 2015
Posts: 15
cwkotch is on a distinguished road
Default

Column b has my time into work as military time

Column C has my time off also as military time.

Column D has total on duty hours. 1900 0600 25.00
However, if I report for work at 1900 hours, and leave at 0600, the calculation adds the time no matter.
Reply With Quote
  #4  
Old 07-27-2022, 10:30 AM
ArviLaanemets ArviLaanemets is offline Another Military Time conundrum Windows 8 Another Military Time conundrum Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

I'm not sure about this military time stuff - is it possible to format Excel cell containing date or time as military time (format "hhmm"), or it is really an integer value, but anyway having only time registered (without date part) will make any calculations with those times (on and off) a headache!

Let's assume you have columns OnTime and OffTime formatted as time (I'll leave military part off now - so "hh:mm" - i.e. without date part).

When both OnTime and OffTime are always on same date, calculating working time is easy:
WorkTime = OffTime - OnTime. Like 16:00 - 08:00 = 08:00.

When OnTime is on one date, and OffTime is on next date, and working time is less than 24 hours (like OnTime = 16:00 and OffTime = 02:00), the formula for WorkTime must check which time has greater value. When OffTime is greater, then WorkTime = OnTime - OffTime. When OnTime is greater, then WorkTime = 24:00 - OnTime + OffTime.

Thins get more messy, when working time can be more than 24 hours. Like OnTime = 16:00 on first day, and OffTime = 18:00 on next day. Having only time registered, you have no way to check, were you off on same day or on next one.

The only way to make the calculation foolproof, is to include date part too (NB! You can format both columns to display only time, but you have to enter date and time!). Like
OnTime = 26.07.2022 16:00, OffTime = 27.07.2022 18:00. Column WorkTime must be formatted as "[h]:mm" (NB! Brackets are essential here!). The formula for WorkTime will be simply WorkTime = OffTime - OnTime, and will return 26:00 (This format displays times over 24 hours. Any other time format displays 02:00!).

When you can format datetime columns as military time, the last formula will work too. When you can't - then maybe someone can give better advice!
Reply With Quote
  #5  
Old 07-28-2022, 05:12 AM
Logit Logit is offline Another Military Time conundrum Windows 10 Another Military Time conundrum Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Code:
=MOD(C2-B2,1)
Example :


On duty ... 20:00 hrs; Off duty ... 01:00. Paste formula in D2, copy down column.
Attached Files
File Type: xlsx How Many Hours EvenPastMidnight.xlsx (9.9 KB, 4 views)
Reply With Quote
  #6  
Old 07-28-2022, 11:22 AM
spillerbd spillerbd is offline Another Military Time conundrum Windows 10 Another Military Time conundrum Office 2021
Competent Performer
 
Join Date: Jan 2016
Posts: 130
spillerbd is on a distinguished road
Default

You should include the day/date portion of the values when calculating elapsed time.
As far as "Military Time" that is just a formatting thing that has noting to due with the calculation.
Most people seem to want to enter the Time separate from the date. You can enter the the current Date and Time using the keystrokes:
CTRL+: CTRL+;
and then edit if you're entering from a separate record.
Reply With Quote
  #7  
Old 07-29-2022, 05:36 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Another Military Time conundrum Windows 7 64bit Another Military Time conundrum Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,770
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Post a sample sheet please( no pics)
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #8  
Old 02-21-2023, 11:04 PM
ArviLaanemets ArviLaanemets is offline Another Military Time conundrum Windows 8 Another Military Time conundrum Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

In case the date part is always left out, and calculated time interval will always be less then 24 hours, the formula like below will work
Code:
=(B2<A2) + B2-A2
Btw, when you enter a time value without date part, you really are entering a datetime value like 00.01.1900 19:00 (what essentially is a time value from day 31.12.1899)!
Reply With Quote
Reply

Tags
boogered up, military time

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I plot data points on time axis proportionally to time scale? gib65 Excel 4 04-05-2022 10:24 PM
Obtaining a decimal total hours from military time entries (my solution works only in Google Sheets) gluonman Excel 8 03-22-2017 08:26 PM
Another Military Time conundrum Employee Turnover by Department/Month split between Voluntary/Involuntary - Full-time/Part-time CPSmith Excel 1 03-26-2016 02:48 AM
Military Font in Word jmdraft Word 2 03-06-2016 05:31 AM
IE Object: Run-time problem (the link is not clicked in run-time but not in step-in tinfanide Excel Programming 1 03-04-2012 12:05 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft