Adding Business Days to Date

D

Dan R.

How do I add business days to a date to get another date?

For example:

A1 = 4/08/2004
B1 = 5
Add A1 and B1 to get C1 = 4/15/2004?

This is sort of the opposite of the NETWORKDAYS function.
Instead of calculating the number of net workdays between
two dates, I want to add net workdays to one business day
to calculate another business day.

Thanks,
Dan
 
P

Peo Sjoblom

Look at the WORKDAY function, also from the ATP

=WORKDAY(A1,B1,"Holidays_if_needed")
 
A

amadeus068

The problem I am having with ATP is that I distribute worksheets t
other people, and I am pretty sure ATP is not selected. For bot
NETWORKDAYS and WORKDAY are there other custom functions that can b
used? I've tried using this:

Function WORKDAYS(ByVal StartDate As Date, ByVal EndDate As Date) A
Integer
Dim i As Integer
Do Until StartDate = EndDate
If Not (Weekday(StartDate) = vbSaturday Or Weekday(StartDate)
vbSunday) Then
i = i + 1
End If
StartDate = StartDate + 1
Loop
WORKDAYS = i
End Function

And used this as well:

Function GetWorkDays(StartDate As Long, EndDate As Long) As Long
' returns the count of days between StartDate - EndDate minus Saturday
and Sundays
Dim d As Long, dCount As Long
For d = StartDate To EndDate
If Weekday(d, vbMonday) <= 6 Then
dCount = dCount + 1
End If
Next d
GetWorkDays = dCount
End Function


But I get a name error. I am using XL2000. Thank you for your hel
and advice
 
R

Ron Rosenfeld

But I get a name error. I am using XL2000. Thank you for your help
and advice.

You will get a NAME error if the functions are not installed in the module for
the workbook.

<alt-F11> will open the VB Editor.

Ensure your project is selected in the project explorer.

Then Insert/Module and paste the code in that you want to use.


I think you may also get a NAME error if there are naming conflicts. If you've
got duplicate names at various levels, including if you've reNAMED your code
modules to something that is not unique, then Excel cannot resolve the name.


--ron
 

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