Working with military times

Livnlife

New Member
Joined
Jan 12, 2012
Messages
2
I am trying to make a spread sheet that will calculate the total time that an item is used. I am using military time and have the following formula for the calculation
=TIMEVALUE(TEXT(B1,"00\:00"))-(TEXT(A1,"00\:00"))
where A1 is the start time and B1 is the end time. The times are put in as 4 digits military time (hourminute without a :). This works great until the end time(B1) is past midnight such as 0100.
Here is an example:
A1 B1 C1
1300 1530 2:30

A1 B1 C1
2300 0200 #######

Message is that it puts #### if the value is negative.

Any ideas?

:confused:
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I am trying to make a spread sheet that will calculate the total time that an item is used. I am using military time and have the following formula for the calculation
=TIMEVALUE(TEXT(B1,"00\:00"))-(TEXT(A1,"00\:00"))
where A1 is the start time and B1 is the end time. The times are put in as 4 digits military time (hourminute without a :). This works great until the end time(B1) is past midnight such as 0100.
Here is an example:
A1 B1 C1
1300 1530 2:30

A1 B1 C1
2300 0200 #######

Message is that it puts #### if the value is negative.

Any ideas?

:confused:
Try this...

=MOD(TEXT(B1,"00\:00")-TEXT(A1,"00\:00"),1)

Format as [h]:mm
 
Upvote 0
I am trying to make a spread sheet that will calculate the total time that an item is used. I am using military time and have the following formula for the calculation
=TIMEVALUE(TEXT(B1,"00\:00"))-(TEXT(A1,"00\:00"))
where A1 is the start time and B1 is the end time. The times are put in as 4 digits military time (hourminute without a :). This works great until the end time(B1) is past midnight such as 0100.
Here is an example:
A1 B1 C1
1300 1530 2:30

A1 B1 C1
2300 0200 #######

Message is that it puts #### if the value is negative.

Any ideas?

:confused:

Something like:

=TEXT(B1,"00\:00")-TEXT(A1,"00\:00") + (TEXT(B1,"00\:00")+0 < TEXT(A1,"00\:00")+0)
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,665
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top