Autofill based on 2 other cells

caj1980

Board Regular
Joined
Oct 23, 2013
Messages
108
Trying to build a sheet to assist in calculating available working hours vs required hours for a job. Please help with a formula that will calculate Columns D and E based on the logic below:

Sheet is setup like this:

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"]Date
[/TD]
[TD="align: center"]Day
[/TD]
[TD="align: center"]Status
[/TD]
[TD="align: center"]STD HRS
[/TD]
[TD="align: center"]OT HRS
[/TD]
[TD="align: center"]TOTAL HRS
[/TD]
[/TR]
[TR]
[TD="align: center"]2-Jul
[/TD]
[TD="align: center"]WEEKDAY
[/TD]
[TD="align: center"]BLACK
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[TD="align: center"]0
[/TD]
[/TR]
</tbody>[/TABLE]

Column A (DATE)
Column B (Day)= WEEKDAY, WEEKEND, or HOLIDAY
Column C (Status)= BLACK, GRAY, ADVISORY, AWARENESS, or WHITE
Column F (TOTAL HRS)= Sum of D and E

Column D (STD HRS)
If B=WEEKEND or HOLIDAY then D=0; AND if C=BLACK then D=0 regardless of B

Column E (OT HRS)
If B=WEEKEND or HOLIDAY then E=4; AND if C=BLACK then E=0 regardless of B

Same Logic stated differently:
No work can be performed on a BLACK Day
A non-BLACK weekday can have 8 STD HRS and 4 OT HRS
A non-BLACK weekend or HOLIDAY can have 0 STD HRS and 12 OT HRS

Love this forum, always get the help I need! Thanks in advance!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I think you have a typo in your original description (no mention of 8 in column D and E descriptions), but I think this may be what you are after.

Formula for cell D2:
=IF(OR(B2="WEEKEND",B2="HOLIDAY",C2="BLACK"),0,8)

Formula for cell E2:
=IF(C2="BLACK",0,IF(OR(B2="WEEKEND",B2="HOLIDAY"),12,4))
 
Upvote 0
I think you have a typo in your original description (no mention of 8 in column D and E descriptions), but I think this may be what you are after.

Formula for cell D2:
=IF(OR(B2="WEEKEND",B2="HOLIDAY",C2="BLACK"),0,8)

Formula for cell E2:
=IF(C2="BLACK",0,IF(OR(B2="WEEKEND",B2="HOLIDAY"),12,4))




Works perfectly, Joe4, THANK YOU!!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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