Calculating overnight hours

adelao747

New Member
Joined
May 9, 2017
Messages
12
Hi guys,

I created a time entry spreadsheet for my company for employees who are working temporarily. However, the formula I have doesn't seem to calculate overnight hours well. The total hours keep coming-up as a negative. Does anyone know how to modify it so that I can calculate overnight hours? I have included my formula down below.

- If anyone knows how to attach a spreadsheet, please let me know, as this will be a lot easier.

Layout:
Time In (C9), Lunch Out (D9), Lunch In (E9), Time Out (F9), Total Hours (G9)

Formula:
=IF(((D9-C9)+(F9-E9))*24>8,8,((D9-C9)+(F9-E9))*24)


Thank so much!
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,239
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style=";">Start</td><td style=";">Lunch</td><td style="text-align: right;;"></td><td style=";">End</td><td style=";">Total</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style="text-align: right;;">18:00</td><td style="text-align: right;;">20:00</td><td style="text-align: right;;">20:30</td><td style="text-align: right;;">4:00</td><td style="text-align: right;;">9.5</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:1.2em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">7b</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">G9</th><td style="text-align:left">=(<font color="Blue">F9-C9+(<font color="Red">F9<C9</font>)-(<font color="Red">E9-D9</font>)</font>)*24</td></tr></tbody></table></td></tr></table><br />
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,208
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Excel Workbook
CDEFG
8InLunch outLunch InOutTot Hrs
97:00 AM11:00 AM12:00 PM4:00 PM8.00
107:00 PM10:00 PM11:00 PM4:00 AM8.00
117:45 PM11:00 PM12:00 AM4:30 AM7.75
Sheet14
 

Watch MrExcel Video

Forum statistics

Threads
1,108,973
Messages
5,525,988
Members
409,673
Latest member
Riseee

This Week's Hot Topics

Top