4 Day Work Week

Guzzlr

Well-known Member
Joined
Apr 20, 2009
Messages
946
Office Version
  1. 2016
Platform
  1. Windows
Hello All,
I have:
VBA Code:
ActiveCell.Formula = "=IF(OR($D$2=$B4,$E$2=$B4),$G4, IF(MEDIAN($D$2,$E$2,$B4)=$B4,IF($D$2<$E$2,$G4,""""),IF($E$2<$D$2,$G4,""-"")))"
This code works well to gain my times for a second shift of 4:30PM to 3:30AM the following day (cross over midnight to the next day)

I need to change this code, to only pick up Mon, Tue, Wed, Thu, days, where Column S has all the days listed.

So I've tried:
Code:
Range("Q4").Select
ActiveCell.Formula = "=IF(OR($D$2=$B4,$E$2=$B4),$G4, IF(MEDIAN($D$2,$E$2,$B4)=$B4,IF($D$2<$E$2,$G4,""""),IF($E$2<$D$2,$G4,""-""))*OR($S4=""Mon"",$S4=""Tue"",$S4=""Wed"",$S4=""Thu""),$G4,""""))"
Selection.AutoFill Destination:=Range("Q4:Q" & Range("A" & Rows.Count).End(xlUp).Row)
Range(Selection, Selection.End(xlDown)).Select

this is not working, is there a way to incorporate the code to only see Mon - Thu and leave out Fri -Sun?

Thank you
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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