Does anyone know how to setup a function argument for a start and end date that will allow for the calculation of the day of the week.

For example:
Start Date = Thursday, April 01, 2010 End Date = (StartDate+30) Saturday, May 01, 2010

I need the formula to return the value of a WEEKDAY date if the end date falls on a weekend date. I need it to subtract 1 day if the end date is on a Saturday or subtract 2 days if the end date is on a Sunday.