Thread: IF formula Thanks:  7 Post #5337968 (1)Post #5347587 (1)Post #5337996 (1)Post #5336772 (1)Post #5338008 (1) Likes:  2 Post #5337968 (1)Post #5337996 (1)

1. Re: IF formula help

Ok so the timesheets were tested and an issue has been raised with them if the guys put in they work 8 hours normal and 1.5 hours at 1.5 times it is then giving a minus figure in the double time field, how can I fix this? (if the 1.5 time column doesn't show 2 that is when it puts the 2 x column into minus)

2. Re: IF formula help

OT 2 was asuming 1.5 time meant there wa also 2.0 time so I've added a MAX

A B C D E F G H I J K
1 Day Site Name Job No Date Start Time Break Finish Time Hours Normal 1.5 Time 2.0 Time
2 Monday 01-Jan-19 7:00 21:00 14
3 01-Jan-19 9:00 12:00 3
4 01-Jan-19 12:00 1:00 16:00 3 8 2.00 21.33
5
6 02-Jan-19 9:00 17:45 8.75 8 1.13 0.00
7
8 03-Jan-19 9:00 1:00 20:00 10
9 03-Jan-19 8:00 2:00 17:00 7 8 2.00 15.33
10
11 04-Jan-19 9:00 1:30 17:30 7 7
12
13 05-Jan-19 9:00 17:00 8 8
Nunya6

Worksheet Formulas
Cell Formula
H2 =IF(E2<>"",(G2-E2-F2)*24,"")
I2 =IF(AND(D2<>D3,D2<>""),MIN(SUMIFS(H:H,D:D,D2),8),"")
J2 =IF(AND(ISNUMBER(I2),SUMIFS(H:H,D:D,D2)>8),MIN(SUMIFS(H:H,D:D,D2)-8,1.33333)*1.5,"")
K2 =IF(ISNUMBER(J2),MAX(0,(SUMIFS(H:H,D:D,D2)-9.333333)*2),"")

3. Re: IF formula help

Ok so another spanner has been thrown in the works.

When the guys do night shift 6pm-7am it returns a negative value and the formulas dont work

What I am trying to do is use one row starting with row 7 as a night shift only column I know you can use a custom format
#,###;#,### which turns it into a positive value or you can go =H7*-1 to turn it into a positive but getting it to work in with the formulas is driving me crazy I cannot work it out

4. Re: IF formula

I can just leave it and manually convert it but would be nicer if there was a way to turn it into a positive and still work with the formulas

it will only be one row per day

5. Re: IF formula

 Day Site Job Date Start Time break finish time hours normal 1.5 time 2.0 time Monday X 01/01/19 630am 7:30am 1 1 Y 01/01/19 7:30am :30 4pm 8 7 1 01/01/19 4pm 18:00 2 1 1 01/01/19 01/01/19 Night Shift Z 01/01/19 6pm 3:30am -14.50 14.50 daily total 01/01/19 8 2 15.50

Ok so currently everything works but one of the guys has raised issues which I now have to fix and need help please. Currently you out the dates in and hours etc and it comes up as a daily total which I still need to happen.

However in the red is what I also need to happen so I need the hours to show per job X Y so forth and then the daily totals down the bottom.

I also need to get the night shift row to convert to a positive figure and sit in double time field.

Is this douable??? Remebering the normal hours have to cap at 8, 1.5 time has to cap at 2 and the rest goes into double time with no multiplications now just hours as they are.

6. Re: IF formula

Nunya,

I'm on vacation for a few weeks, over 4,000 miles from home, so won't be able to help.

Your latest sample data has incorrect format times entered and it looks like you've changed the trigger to job rather than date so I'm not sure what to do if the date changes, or a job appears across days, or if the job needs the OT calculation or if it's the staff only. You could change the Hours calculation to account for going past midnight but it will be against the start day and not the second day.

Code:
`=IF(E2="","",IF(G2 < E2,((1-E2)+G2-F2)*24,(G2-E2-F2)*24))`

If I fix the time format of your data then on my version of the sheet it is:

A B C D E F G H I J K
1 Day Site Job Date Start Time break finish time hours normal 1.5 time 2.0 time
2 Monday X 1/1/2019 6:30 7:30 1
3 Y 1/1/2019 7:30 0:30 16:00 8
4 1/1/2019 16:00 18:00 2
5 1/1/2019
6 1/1/2019
7 Night Shift Z 1/1/2019 18:00 3:30 9.5
8 daily total 1/1/2019 8 2.00 22.33
Nunya8

Worksheet Formulas
Cell Formula
H2 =IF(E2="","",IF(G2(1-E2)+G2-F2G2-E2-F2)*24))
I2 =IF(AND(D2<>D3,D2<>""),MIN(SUMIFS(H:H,D:D,D2),8),"")
J2 =IF(AND(ISNUMBER(I2),SUMIFS(H:H,D:D,D2)>8),MIN(SUMIFS(H:H,D:D,D2)-8,1.33333)*1.5,"")
K2 =IF(ISNUMBER(J2),MAX(0,(SUMIFS(H:H,D:D,D2)-9.333333)*2),"")