Finding and Recording Data only on specific Days.

Guzzlr

Well-known Member
Joined
Apr 20, 2009
Messages
955
Office Version
  1. 2016
Platform
  1. Windows
Hello All.
I have a shift, that only works Saturday thru Monday (3 Days)

I have:
VBA Code:
Range("T3").Select
ActiveCell.FormulaR1C1 = "3rd Shift Actual Wt."
Range("T4").Select
ActiveCell.Formula = "=IF(AND($B4>=$G$2,$B4<=$H$2),$G4,"""")"
Selection.AutoFill Destination:=Range("T4:T" & Range("A" & Rows.Count).End(xlUp).Row)
Range(Selection, Selection.End(xlDown)).Select

Where G2 and H2 are start and end times of 5:00:00 AM & 4:00:00PM respectively, and on the same day (not crossing midnight into the next day)
Where G4 is data I wish to select

AND

Code:
'Add Day of Week
Range("S3").Select
ActiveCell.FormulaR1C1 = "Day of Week"
Range("S4").Select
ActiveCell.Formula = "=IF(A4<>"""",TEXT($A4,""ddd""),"""")"
Selection.AutoFill Destination:=Range("S4:S" & Range("A" & Rows.Count).End(xlUp).Row)
Range(Selection, Selection.End(xlDown)).Select

Where Column A is Date Format of xx/xx/xxxx and column S is the day format of "ddd" from above code.

The problem, is finding the data of column G on the specific days of Saturday, Sunday, and Monday, using the Shift Times in G2 & H2.

Can someone lead me in the right direction please

Thank you
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I believe I have answered my own question...
I have:
Code:
=IF(AND($B4>$G$2,$B4<$H$2)*OR($S4="Sat",$S4="SUN",$S4="Mon"),$G4,"")

This appears to be working

I do have a couple of questions:
1. Why does excel want me to place an "*" before the "OR" statement? Is this acting as a wildcard?
2. Is there a better way of doing this?

Thank you
 
Upvote 0

Forum statistics

Threads
1,215,438
Messages
6,124,873
Members
449,192
Latest member
MoonDancer

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