In my previous post I showed a function that can help pull a certain instance of a day of the week using VBA. In this post, I’ll show how to do that without VBA. Specifically, three things this post will look at: 1) how to find the first Monday of the month 2) how to find the date ending/starting of a week, and 3) how to find the 3rd Monday of the month**1.Finding the first Monday of the month**

First, I need to identify the weekday that the first day of the year falls on with this formula:

Formula 1.A

=WEEKDAY(DATE(2014,1,1))

This returns 4 (Wednesday).

Next I’ll determine how many days away this is from my desired day – Monday. Since Monday is the 2nd day of the week, the first day of the year is 2 (4-2) days after Monday. If you want to use another day instead of Monday then change the 2 to the corresponding day of the week (for example, Sunday is 1 – assuming your settings are setup for weeks starting on a Sunday).

With 7 days in a week, I need to deduct 2 from 7, making 5 days that I need to add to the first day of the year to get to the first Monday of the year. The formula so far looks like this:

Formula 1.B

However, this formula will only work if the first day of the month falls after Monday. I need to include an IF statement so that in the case that Monday (or whatever day I choose) falls after the first day of the year, it will just add the difference. The formula that follows includes this consideration:

Formula 1.D

=DATE(**YEAR**,**MONTH**,1)+IF(WEEKDAY(DATE(**YEAR**,**MONTH**,1))-**WEEKDAYNUMBER**<=0,**WEEKDAYNUMBER**-WEEKDAY(DATE(**YEAR**,**MONTH**,1)),7-((WEEKDAY(DATE(**YEAR**,**MONTH**,1))-**WEEKDAYNUMBER**)))**2. How to find the 3rd Monday of the month**

Continuing from Formula 1.D, I’m going to make an adjustment to calculate the proper week. To do this I need to add two weeks to the formula:

Formula 2.A

=DATE(**YEAR**,**MONTH**,1)+((**XTHOCCURRENCE**-1)*7)+IF(WEEKDAY(DATE(**YEAR**,**MONTH**,1))-**WEEKDAYNUMBER**<=0,**WEEKDAYNUMBER**-WEEKDAY(DATE(**YEAR**,**MONTH**,1)),7-((WEEKDAY(DATE(**YEAR**,**MONTH**,1))-**WEEKDAYNUMBER**)))

**3. Find the date ending/starting of a week**

If you have weekly reporting and reference a week number, you may find it useful to show what date that week relates to.

This formula builds off of Formula 1.D. One difference is the month will always be set to 1 because we need to know the first weekday of the year. This is important to determine the number of weeks that need to be added.

**YEAR**,1,1)+IF(WEEKDAY(DATE(

**YEAR**,1,1))-

**WEEKDAYNUMBER**<=0,(

**WEEKNUMBER**-1)*7+

**WEEKDAYNUMBER**-WEEKDAY(DATE(

**YEAR**,1,1)),(

**WEEKNUMBER**-2)*7+7-((WEEKDAY(DATE(

**YEAR**,1,1))-

**WEEKDAYNUMBER**)))

## Add a Comment

You must be logged in to post a comment