time calculations

jtodd

Board Regular
Joined
Aug 4, 2014
Messages
194
Hi
I have a sheet that works out hours worked which all works fine till I hit exactly midnight .( see extract)
I am using this formula =(IF(F18>E18,F18-E18,24-E18+F18))-"00:30" (half an hour lunch)
I am using [h]:mm to format the totals but as you can see it does not work for the bottom 2

<colgroup><col style="mso-width-source:userset;mso-width-alt:4022;width:83pt" width="110"> <col style="mso-width-source:userset;mso-width-alt:4022;width:83pt" width="110"> <col style="mso-width-source:userset;mso-width-alt:2998;width:62pt" width="82"> <col style="mso-width-source:userset;mso-width-alt:4022;width:83pt" width="110"> <col style="mso-width-source:userset;mso-width-alt:4022;width:83pt" width="110"> <col style="mso-width-source:userset;mso-width-alt:2779;width:57pt" width="76"> </colgroup><tbody>
</tbody>

<colgroup><col style="width:48pt" span="3" width="64"> <col style="mso-width-source:userset;mso-width-alt:2084; width:43pt" span="2" width="57"> <col style="width:48pt" span="5" width="64"> </colgroup><tbody>
[TD="class: xl66, width: 64"]Start
[/TD]
[TD="class: xl66, width: 64"]Finnish
[/TD]
[TD="class: xl66, width: 64"]Hours[/TD]
[TD="class: xl66, width: 57"]Start [/TD]
[TD="class: xl66, width: 57"]Finnish [/TD]
[TD="class: xl66, width: 64"]Hours[/TD]
[TD="class: xl66, width: 64"]Start [/TD]
[TD="class: xl66, width: 64"]Finnish [/TD]
[TD="class: xl66, width: 64"]Hours[/TD]
[TD="class: xl66, width: 64"]Total [/TD]

[TD="class: xl68"]06:00[/TD]
[TD="class: xl68"]14:00
[/TD]
[TD="class: xl65"]07:30[/TD]
[TD="class: xl68"]06:00[/TD]
[TD="class: xl68"]16:00[/TD]
[TD="class: xl65"]09:30[/TD]
[TD="class: xl68"]06:00[/TD]
[TD="class: xl68"]14:00[/TD]
[TD="class: xl65"]07:30[/TD]
[TD="class: xl67"]24:30
[/TD]

[TD="class: xl68"]06:00[/TD]
[TD="class: xl68"]14:00[/TD]
[TD="class: xl65"]07:30[/TD]
[TD="class: xl68"]06:00[/TD]
[TD="class: xl68"]16:00[/TD]
[TD="class: xl65"]09:30[/TD]
[TD="class: xl68"]06:00[/TD]
[TD="class: xl68"]14:00[/TD]
[TD="class: xl65"]07:30[/TD]
[TD="class: xl67"]24:30
[/TD]

[TD="class: xl68"]12:00[/TD]
[TD="class: xl68"]00:00[/TD]
[TD="class: xl65"]11:30[/TD]
[TD="class: xl68"]12:00[/TD]
[TD="class: xl68"]00:00[/TD]
[TD="class: xl65"]11:30[/TD]
[TD="class: xl68"]12:00[/TD]
[TD="class: xl68"]01:00[/TD]
[TD="class: xl65"]12:30[/TD]
[TD="class: xl67"]1691:30[/TD]

[TD="class: xl68"]12:00[/TD]
[TD="class: xl68"]00:00[/TD]
[TD="class: xl65"]11:30[/TD]
[TD="class: xl68"]12:00[/TD]
[TD="class: xl68"]00:00[/TD]
[TD="class: xl65"]11:30[/TD]
[TD="class: xl68"]12:00[/TD]
[TD="class: xl68"]01:00[/TD]
[TD="class: xl65"]12:30[/TD]
[TD="class: xl67"]1691:30
[/TD]

</tbody>

Presume it is something to do with the formatting of the Total , unless there is a better approach ?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Time is a fickle thing in Excel as it's a number masked to look like time. Could very well be you've copied time from a previous entry and it's 70 days in the past...

Use the MOD function to get round this


Book1
ABCDEFGHIJ
1StartFinnishHoursStartFinnishHoursStartFinnishHoursTotal
206:0014:0007:3006:0016:0009:3006:0014:0007:3024:30:00
306:0014:0007:3006:0016:0009:3006:0014:0007:3024:30:00
412:0000:0011:3012:0000:0011:3012:0001:0012:3035:30:00
512:0000:0011:3012:0000:0011:3012:0001:0012:3035:30:00
Sheet1
Cell Formulas
RangeFormula
I2=MOD(H2-G2, 1)-TIMEVALUE("00:30:00")
J2=I2+F2+C2
C2=MOD(B2-A2, 1)-TIMEVALUE("00:30:00")
F2=MOD(E2-D2, 1)-TIMEVALUE("00:30:00")
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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