Last day of month that isn't saturday or sunday

B

Brent

Is there a quick formula to look at a date and calculate the last day of
that month that isn't a Saturday or Sunday. Date field is InvDate.

Thanks
Brent
 
M

[MVP] S.Clark

Last Day of month is easy. Take the first day of the next month, then
subtract one day. Use DateSerial() to help.
Once that day is known, get the DOW for that day. Use that to determine if
it is a Sat or Sun.
 
M

Marshall Barton

Brent said:
Is there a quick formula to look at a date and calculate the last day of
that month that isn't a Saturday or Sunday. Date field is InvDate.


Try something like:

DateSerial(Year(somedate), Month(somedate) + 1. 0) -
IIf(Weekday(DateSerial(Year(somedate), Month(somedate) + 1.
0), 7) > 2, 0, (Weekday(DateSerial(Year(somedate),
Month(somedate) + 1. 0), 7))
 
B

Brent

Thanks
Marshall Barton said:
Try something like:

DateSerial(Year(somedate), Month(somedate) + 1. 0) -
IIf(Weekday(DateSerial(Year(somedate), Month(somedate) + 1.
0), 7) > 2, 0, (Weekday(DateSerial(Year(somedate),
Month(somedate) + 1. 0), 7))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top