Need help with conditional IF statement

smoochie2069

New Member
Joined
Sep 10, 2014
Messages
3
I need a conditional statement for the cell "OT Hours" that will calculate the amount of hours over 40 from the "Regular Time Hours" but only if none of the previous 7 cells contain "Vacation" in which case, it should be zero. By the way, Shifts are 12 hours and Vacation days are 8 hours so in the example below, the appropriate answer for OT Hours would be 0 (zero). Reason is that an employee does not get paid for hours over 40 unless they actually work over 40 hours not counting vacation time. Thanks in advance!

[TABLE="width: 1012"]
<tbody>[TR]
[TD][/TD]
[TD]Sun
[/TD]
[TD]Mon
[/TD]
[TD]Tue
[/TD]
[TD]Wed
[/TD]
[TD]Thu
[/TD]
[TD]Fri
[/TD]
[TD]Sat
[/TD]
[TD]Regular Time
[/TD]
[TD]OT
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Employee
[/TD]
[TD]14-Sep-14
[/TD]
[TD]15-Sep-14
[/TD]
[TD]16-Sep-14
[/TD]
[TD]17-Sep-14
[/TD]
[TD]18-Sep-14
[/TD]
[TD]19-Sep-14
[/TD]
[TD]20-Sep-14
[/TD]
[TD]Hours
[/TD]
[TD]Hours
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 935"]
<tbody>[TR]
[TD]OPEN-Supervisor
[/TD]
[TD]Shift B
[/TD]
[TD]Vacation
[/TD]
[TD]OFF
[/TD]
[TD]Shift B
[/TD]
[TD]Shift B
[/TD]
[TD]OFF
[/TD]
[TD]OFF
[/TD]
[TD="align: right"]44.0
[/TD]
[TD="align: right"] 4.0
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
If Your data starts in the range B3-H3 then try this:
=IF(COUNTIF(B3:H3,"Vacation")>0,0,I3-40)
 
Upvote 0
Thank you for this and this works great if there are hours over 40 but I need something that gives the result as zero if the hours are under 40. This formula creates a credit in the overtime hours when there is less than 40 hours in a week. Any ideas?
 
Upvote 0
Thank you for this and this works great if there are hours over 40 but I need something that gives the result as zero if the hours are under 40. This formula creates a credit in the overtime hours when there is less than 40 hours in a week. Any ideas?

Maybe?
=IF(OR(COUNTIF(B3:H3,"Vacation")>0,I3<40),0,I3-40)
 
Upvote 0
Unfortunately, that gave a -40 in the hours when over 40. I'm at a loss! :eeek:

The formula assumes that the weekdays resides in column B to H, and the "Regular Time Hours" in column I.
So you might have to adjust the ranges in the formula to fit Your ranges.

Vidar
 
Upvote 0

Forum statistics

Threads
1,225,399
Messages
6,184,752
Members
453,254
Latest member
topeb

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