Use the formula,
=YourDate + IF(WEEKDAY(YourDate,2) = 6, -1, IF(WEEKDAY(YourDate,2) = 7,
1,0))

Where, YourDate is the date as returned by your UDF. The WeekDay() function,
returns am integer From 1(=monday) to 7(=sunday).

Regards

Ajit

On Thu, Oct 23, 2008 at 10:47 PM, David <[EMAIL PROTECTED]> wrote:

>
> I am working in Excel VBA.  I need to write a custom Workdays
> function.  We are building houses.  It does not matter what day we
> start on (we can start on a Saturday or Sunday) and holidays do not
> matter.  The function will look like this:
>
> function(D1 as date, i1 as integer) as date
>
> The problem is that if the function initially returns a Saturday, I
> need to return the Friday before.  If it initially returns a Sunday, I
> need to return the Monday after.
>
> Any help would be appreciated.  Thanks.
>
> David
>
> >
>


-- 
Thank You,

Ajit Navre

--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to