Working with Dates

Rhino373

New Member
Joined
Sep 13, 2011
Messages
28
I'm at the end of my programming and I need help working with dates. My data is organized by date. A button is available to look at yesterday's data. This is simply programmed as Now() -1.

In this case on Monday it would not show me what I want to see as it would filter for Sunday where nothing occured. I need a function to say if Now() represents Monday then Now() - 3.

How do I extrapolate the day of the week from date?

My whole function looks like this:

Code:
Function ViewJournalEntries()
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.AutoFilter
ActiveSheet.Range("$A$2:$AN$10").AutoFilter Field:=1, Criteria1:=Array( _
    "xxxxxxx", "xxxxxxx", "xxxxxxx"), Operator:=xlFilterValues
ActiveSheet.Range("$A$2:$AN$10").AutoFilter Field:=39, Operator:= _
    xlFilterValues, Criteria2:=Array(2, Now())
End Function
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
In this example I am just filtering for Now() not Now() - 1 just because its not working like I expect it to.
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,920
Latest member
jaspers

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