Skip to main content
Question

Weekdaysub - Count end date

  • October 11, 2022
  • 0 replies
  • 128 views

Hello,

I'm trying to calculate the number of weekdays in a range but don't want the count to stop the day before the end date.

Example date ranges:
9/16-9/30 has 11 weekdays (starts on Friday and ends on Friday)
10/01-10/15 has 10 weekdays (starts on Saturday and ends on Saturday)

Formula:
WeekdaySub([Pay Period End Date],[Pay Period Start Date])

Returns the correct count for the October date range however it does not count correctly for the September range. Not sure what direction to go from here.... Please help!

------------------------------
Sindy Hanner
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+20
  • Registered
  • October 11, 2022
WeekDay Sub subtracts and counts weekdays in the interval, but not including the last day. So it is not counting your last day. Your October one doesn't matter because the last day is Saturday, but in September it matters.

"WeekdaySub (Date d2, Date d1)

Description: Returns the number of weekdays in the interval starting with d1 and ending on the day before d2"

I think if this may work, but untested:

WeekdaySub([Pay Period End Date] +Days(1), [Pay Period Start Date])

------------------------------
Mike Tamoush
------------------------------

MarkShnierYou
Forum|alt.badge.img+24
I think you need to add on an extra day if the last day is not on a weekend.  

WeekdaySub([Pay Period End Date],[Pay Period Start Date])
+
If(
DayOfWeek([Pay Period End Date])<>0
and
DayOfWeek([Pay Period End Date])<>6, 1,0)

------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------