tfowlerusa
New Member
- Joined
- Mar 28, 2017
- Messages
- 13
Good morning. I am trying to put a time sheet together and I am having issues with a few formulas. I have a Code Shift column that I am trying to use to sort time worked into a specific code. Code1 hours are 6am to 6pm, Code 2 6pm to 12am, and Code 3 from 12am to 6am. Then placing the time worked into the specific Code Shift Column. I have so problems with adjusting the times in the formula to put the times into the correct column. Also would love to have cells blank when there is not data to calculate. Any help would be appreciated. Thank you Todd
On Call Log.xlsx | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | |||
2 | Hours | Code | Code 1 Shift | Code 2 Shift | Code 3 Shift | |||||
3 | Employee | Date | Start Time | Stop Time | Shift | Total Time | Total Time | Time | ||
4 | Varon | 20-Jan | 12:00 PM | 12:18 PM | Code 1 | 0:18 | ||||
5 | 8:30 AM | 9:30 AM | Code 1 | 1:00 | ||||||
6 | 12:20 PM | 1:20 PM | Code 1 | 1:00 | ||||||
7 | 1:45 PM | 2:00 PM | Code 1 | 0:15 | ||||||
8 | 3:00 PM | 3:45 PM | Code 1 | 0:45 | ||||||
9 | 3:45 PM | 4:00 PM | Code 1 | 0:15 | ||||||
10 | 4:00 PM | 4:15 PM | Code 1 | 0:15 | ||||||
11 | 5:00 PM | 6:00 PM | Code 3 | |||||||
12 | 6:45 PM | 7:15 PM | Code 3 | |||||||
13 | 11:30 PM | 12:00 AM | Code 1 | #VALUE! | ||||||
14 | Code 3 | 0:00 | ||||||||
15 | Code 3 | 0:00 | ||||||||
16 | Code 3 | 0:00 | ||||||||
17 | Code 3 | 0:00 | ||||||||
18 | Code 3 | 0:00 | ||||||||
19 | Code 3 | 0:00 | ||||||||
20 | Code 3 | 0:00 | ||||||||
21 | Code 3 | 0:00 | ||||||||
22 | Code 3 | 0:00 | ||||||||
23 | Code 3 | 0:00 | ||||||||
24 | Code 3 | 0:00 | ||||||||
25 | Code 3 | 0:00 | ||||||||
26 | Code 3 | 0:00 | ||||||||
27 | Total Hours | |||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E4:E26 | E4 | =IF(AND(C4>=TIME(6,0,0), D4<TIME(18,0,0)), "Code 1", IF(AND(C4>=TIME(18,0,0), D4<TIME(24,0,0)), "Code 2", IF(OR(C4<TIME(6,0,0), D4>=TIME(24,0,0)), "Code 3", "Invalid Time"))) |
F4:F26 | F4 | =IF(E4="Code 1", TEXT(D4-C4, "h:mm"), "") |
G4:G26 | G4 | =IF(E4="Code 2", TEXT(D4-C4, "h:mm"), "") |
H4:H5,H7:H10,H13:H26 | H4 | =IF(E4="Code 3", TEXT(D4-C4, "h:mm"), "") |
H6 | H6 | =IF(E6="Code 3", IF(ISNUMBER(C6), IF(ISNUMBER(D6), IF(C6 < D6, TEXT(D6 - C6, "h:mm"), TEXT(1 - C6 + D6, "h:mm")), ""), ""), "") |