IF AND OR nested

AndyB63UK

New Member
Joined
Oct 5, 2011
Messages
47
Im trying to calculate work time and overtime. The basic hours are 8, overtime at time and a half is between 8 hours and 12 hours, and double time is over 12 hours. so if the total hours worked in G7 that day are 14:30, then how do I get cells Basic G8 = 8:00, OT 1.5 G9 = 4:00 and OT 2.0 G10 = 2:30. or it only 7:15 total in G7 then G8 = 7:15, G9 = blank, G10 = blank?

Hope that makes sense
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
See if these, copied across, do what you want.

Excel Workbook
FGHI
7Total14:307:1510:23
8Normal8:007:158:00
9OT(x1.5)4:002:23
10OT(x2)2:30
OT
 
Last edited:
Upvote 0
I can't seem to paste a copy of my sheet into here, but the column headings are;

Date, Start time, break 1, break 2, break 3, finish time, total hours, basic, OT 1.5, OT 2
Mon 1,
Tue 2,
Wed 3,
Thu 4,
Fri 5,
Sat 6,
Sun 7,

Saturday is always OT1.5 for first 8 hours the OT2
Sunday is always OT2 regardless

Thanks
 
Last edited:
Upvote 0
Apart from the weekend issue that you have now added, did the previous formulas do what you wanted? If not which one(s) gave the wrong answers and what should the correct answers have been?

Does your Date column contain actual dates (numbers) or just text?

For posting small sample screen shots like I did, read my signature block below.
 
Last edited:
Upvote 0
ABCDEFGHIJ

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]5[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Start[/TD]
[TD="align: center"]Breaks[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]Finish[/TD]
[TD="align: center"]Total[/TD]
[TD="align: center"]Basic[/TD]
[TD="align: center"]OT 1.5[/TD]
[TD="align: center"]OT 2.0[/TD]

[TD="align: center"]6[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]1st[/TD]
[TD="align: center"]2nd[/TD]
[TD="align: center"]3rd[/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Hours[/TD]
[TD="align: center"]8:00[/TD]
[TD="align: center"]12:00[/TD]
[TD="align: center"]>12:00[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: center"]9[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: center"]10[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: center"]11[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: center"]12[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: center"]14[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="bgcolor: #FCE4D6, align: center"]Totals[/TD]
[TD="bgcolor: #FCE4D6, align: center"][/TD]
[TD="bgcolor: #FCE4D6, align: center"][/TD]
[TD="bgcolor: #FCE4D6, align: center"][/TD]
[TD="bgcolor: #FCE4D6, align: center"][/TD]

</tbody>
Sheet1
 
Last edited:
Upvote 0
Yes those formulas now work thank you, apart from the weekend issue.
The dates are formatted as ddd dd but taken from Week Ending, so A7 is =$H$2-6, A8 =$H$2-5 etc

I have another question relating to this sheet. Is there a way to enter time as just 4 digits without the colon AND without VBA. eg. for 08:45 just type 0845 or even just 845 and it be recognised as 08:45? I know this can be don with VBA code but that means a macro enabled file which the android excel app does not recognise or is able to open.
 
Last edited:
Upvote 0
Yes those formulas now work thank you, apart from the weekend issue.
Try these
H7: =MIN(G7,1/3*(WEEKDAY(A7,2)<6))
I7: =IF(WEEKDAY(A7,2)=7,0,IF(G7>H7,MIN(G7-H7,1/6+1/3*(H7=0)),0))
J7: =IF(G7>SUM(H7:I7),G7-SUM(H7:I7),0)


Is there a way to enter time as just 4 digits without the colon AND without VBA.
Not as far as I am aware.
 
Upvote 0
A quick example that you can experiment with.
I have never used this approach on a working time sheet but it may help you.

I have not used your cell references.


Excel 2010
JKLMN
1StartEndTime
2730120004:30:00Format as Time
3
4or
5
6800223014.50Format number
7
8Regular8.00
9OT @ 1.54
10OT @ 2.02.5
11
1a
Cell Formulas
RangeFormula
L2=TEXT(K2,"00\:00")+0-TEXT(J2,"00\:00")+0
L6=(TEXT(K6,"00\:00")+0-TEXT(J6,"00\:00")+0)*24
L8=MIN(8,L6)
L9=IF(L6>L8,MIN(L6-L8,4))
L10=IF(L6>12,L6-12,0)
 
Upvote 0

Forum statistics

Threads
1,223,627
Messages
6,173,421
Members
452,514
Latest member
cjkelly15

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