Adding hours and minute more than 10000 hours

abatheo

New Member
Joined
Feb 23, 2017
Messages
3
Dear,
I have a problem in excel and I need your assistance .
Here there is example of the question I have.
A1=00:20 means 0 hours and 20 minutes
B1=01:30 means 01 hours and 30 minutes
C1= 20000:00 means 20000 hours and 0 minutes
my question is to calculate D1 which should be equal
to C1-B1-(A1/5)


Best regards
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I have a work round to convert entered values into a value that will add up. bit clunky but it seems to work
"type before" formula =TYPE(M2) "2's" are a problem and need to be turned into number
"temp" formula =(LEFT($M2,FIND(":",$M2,1)-1))/24 .. "#VALUE MEANS the original value was a number "
"hours " =IF(N2=1,M2,O2)
"type after " =TYPE(P2) .. note theyre all type 1 / numbers now



time enteredtype beforetemphourstype aftertotal
19999:002833.291666719999:00:00140835:55:00
24:00:001#VALUE!24:00:001
0:201#VALUE!0:20:001
12:361#VALUE!12:36:001
800:00:001#VALUE!800:00:001
9999:59:001#VALUE!9999:59:001
10000:002416.666666710000:00:001

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
<strike></strike>
 
Upvote 0
I've got a bit further with my idea to convert entered times > 10000 hrs into numbers .. removed helper columns

formula in O2 = =IF(ISNUMBER($M2),$M2,(LEFT($M2,FIND(":",$M2,1)-1))/24)

BUT it has a shortcoming ! - at the moment I am only converting the "hours" part into a number and ignoring "minutes" and "seconds"
as you can see my formula gives same result for the last 2 lines 10000:00 and 10000:30
Might be better to do this as VBA but I'm no expert there ..can anyone else help ?



time enteredisnumber?TIME AS NUMBERisnumber nowTOTAL "ENTERED"10836:55:00
19999:30:00FALSE19999:00:00TRUETOTAL "AS NUMBER"50835:55:00
24:00:00TRUE24:00:00TRUE
0:20TRUE0:20:00TRUE
12:36TRUE12:36:00TRUE
800:00:00TRUE800:00:00TRUE
9999:59:00TRUE9999:59:00TRUE
10000:00FALSE10000:00:00TRUE
10000:30FALSE10000:00:00TRUE

<tbody>
</tbody>
 
Last edited:
Upvote 0
Ok I've had a go at doing this as a VBA custom function .. wasn't as hard as I thought
code works for the "hours" and "minutes" but it's not picking up "seconds' can anyone help


code is
Function timeasnumber(init_time) As Double
Dim tempstr As Variant
Dim thours As Double
Dim tmins As Double
Dim tsecs As Double

If IsNumeric(init_time) Then
timeasnumber = init_time
Else
On Error Resume Next
tempstr = Split(init_time, ":")
thours = tempstr(0) / 24
tmins = tempstr(1) / (24 * 60)
tsecs = tempstr(2) / (24 * 3600)
timeasnumber = thours + tmins + tsecs
End If
End Function


result - note that 10000:30:00 and 10000:30:59 return same result


time enteredtimeasnumber vbaTOTAL "ENTERED"10836:55:01
19999:30:0019999:30:00
24:00:0024:00:00total vba60837:25:01
0:200:20:00
12:3612:36:00
800:00:00800:00:00
9999:59:009999:59:00
10000:00:0010000:00:00
10000:30:0010000:30:00
10000:30:5910000:30:00
00:00:010:00:01

<tbody>
</tbody>
 
Last edited:
Upvote 0
*** ok I have a answer now VBA custom function *****

If the input hours are less than 10,000 function recognizes that this is already numeric/date and returns the same value

If the input hours are >= 10,000 function breaks it up into hours, minutes and seconds . Turns into a number and returns revised value

Function timeasnumber(init_time) As Double
Dim tempstr As Variant
Dim thours As Double
Dim tmins As Double
Dim tsecs As Double

If IsNumeric(init_time) Then
timeasnumber = init_time
Else
On Error Resume Next
tempstr = Split(init_time, ":")
thours = tempstr(0) / 24
tmins = tempstr(1) / (24 * 60)
tsecs = tempstr(2) / (CLng(60) * 60 * 24)
timeasnumber = thours + tmins + tsecs
End If
End Function


- enter this code into a module
- insert new column B
- enter formula in B2 , drag down =timeasnumber($A2)

- finally change your SUM formula to refer to B

time enteredtimeasnumber vba10836:55:01<--- sum(a:a) wrong
19999:30:0019999:30:00
24:00:0024:00:0060837:26:00<-- sum(b:b) correct
0:200:20:00
12:3612:36:00
800:00:00800:00:00
9999:59:009999:59:00
10000:00:0010000:00:00
10000:30:0010000:30:00
10000:30:5910000:30:59
00:00:010:00:01

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
Is there any update on this maximum limit for 10000+ hours to be entered directly into a cell?
We first encountered this problem some years ago (everything formatted [h:mm] as suggested above) but someone kindly wrote a macro that took the cell entry in "hrs.mins" (rather than hrs:mins - note decimal not colon), converted it in hidden cells, & then displayed hrs.mins in the original entry cell. This still allows real minutes, rather than decimal ones to be entered & displayed, so no confusion over conversion to decimal.

I don't have the skills to duplicate the macro process/cells etc in a new spreadsheet, which is required for calculating aircraft-critical maintenance, but would be grateful for a simpler way to format or convert an hrs:mins (OR hrs.mins) into a manageable form that will allow direct entry and calculations.
Any assistance/advice gratefully received.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

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