• 0

# Table Formula - Count the number of Saturdays between 2 dates

## Question

My table has 12 records - 1 record for every month of the year. Each record has two date fields, the starting date of the month and the last day of the month.

I am trying to create a formula field in this table that will count the number of Saturdays between the two date fields. Essentially, I need to know the number of Saturdays in the month. I also need to do this with Sundays in a separate formula field.

As you may know, some months do not have an equal amount of Saturdays and Sundays. Sometimes, like the current month today (04/2022), there are 5 Saturdays and 4 Sundays. So, I couldn't just grab the number of weeks in the month and assume there is 1 Saturday for each one.

## Recommended Posts

• 0

Here it is on trigger.

##### Share on other sites

• 0

(((DateDiff(day, [@field:date1], [@field:new_date]))-(7-DatePart(weekday, [@field:date1])))/6) + 1

It works well on Calculated Fileds but we cannot use it on the Formula fields as we cannot use datepart weekday there.

##### Share on other sites

• 0

If you have another weekday in mind, just change the Divisor 6 to any other weekday.

##### Share on other sites

• 0

Many thanks, @NiceDuck!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.