AnsweredAssumed Answered

Workdays in month problem

Question asked by MikeWile on Jan 12, 2018
Latest reply on Jan 15, 2018 by Orlando

Searching this forum I found:

Let([
D = YourDateField ;
startDate = Date ( Month ( D ) ; 1 ; Year ( D ) ) ;
endDate = Date ( Month ( D ) + 1 ; 0 ; Year ( D ) )
];
5 * Int ( ( EndDate - StartDate ) / 7 ) +Middle ( "0012345501234544012343340123223401211234010012340" ; 1 + 7 * (DayOfWeek ( StartDate ) - 1 ) + DayOfWeek ( EndDate ) ; 1 )
)

 

but it doesn't always yield the correct result. Jan, April, June, July, and November show the correct result for the year 2018. Feb, March, May are off by 1. Aug, Sep, Oct are off by 2. Any ideas on why the difference?

Outcomes