#1   Report Post  
Aviator
 
Posts: n/a
Default Skip the Holidays 2

The following formula works well it just does not exclude the holidays.

Calendar Formula without Weekends (Col. E)
=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)
=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D$23+1+(WEEKDAY(D$23+1)2 )*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.
=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D$40+1)+2,D$40+1))
3.
=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E$40+1)+2,E$40+1))
4.
=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator

  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Aviator,

Why not just WORKDAY

=IF(D$6="","",workday(D6,1,holidays))

where holidays is the holidays range

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
The following formula works well it just does not exclude the holidays.

Calendar Formula without Weekends (Col. E)

=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)

=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D
$23+1+(WEEKDAY(D$23+1)2)*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.

=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D
$40+1)+2,D$40+1))
3.

=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E
$40+1)+2,E$40+1))
4.

=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F
$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator



  #3   Report Post  
Aviator
 
Posts: n/a
Default

This works great. The only problem is that we only work Monday thru Thusday.
That is why I was using:

=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1)+2,D$6+1))

Is there a way to accomplish both 4 day work weeks and skipping the holidays?

Thank you,

Aviator


"Bob Phillips" wrote:

Aviator,

Why not just WORKDAY

=IF(D$6="","",workday(D6,1,holidays))

where holidays is the holidays range

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
The following formula works well it just does not exclude the holidays.

Calendar Formula without Weekends (Col. E)

=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)

=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D
$23+1+(WEEKDAY(D$23+1)2)*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.

=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D
$40+1)+2,D$40+1))
3.

=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E
$40+1)+2,E$40+1))
4.

=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F
$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Aviator,

It can be done with formulae, but they can be very complex. I prefer to have
a UDF that does it. This is such a UDF that I have adapted from one of my
date UDFs. You would use it like so

=fWORKDAY(D$5,1,holidays,FALSE)

The last FALSE is important otherwise it just works like a normal WORKDAY
function.

'---------------------------------------------------------------------
Function fWORKDAY(StartDate As Variant, _
Days As Variant, _
Optional Holidays, _
Optional IncFri As Boolean = True)

'---------------------------------------------------------------------
Dim cDays As Long, cDays2 As Long
Dim StartDateWe As Date, EndDate As Date, EndDateWE As Date

Application.Volatile

'check if valid arguments
If (Not IsDate(StartDate)) Then
GoTo DF_errValue_exit
ElseIf (Not IsNumeric(Days)) Then
GoTo DF_errValue_exit
ElseIf Days < 1 Or IsEmpty(Days) Then
GoTo DF_errValue_exit
ElseIf (Not IsMissing(Holidays)) Then
If (TypeName(Holidays) < "Range" And _
TypeName(Holidays) < "String()" And _
TypeName(Holidays) < "Variant()") Then
GoTo DF_errValue_exit
End If
End If

#If fDebug Then
Debug.Print StartDate & ", " & _
Days & ", " & _
IncSat & ", " & _
IncSun
#End If

EndDate = Application.Run("ATPVBAEN.XLA!WORKDAY", StartDate, Days,
Holidays)

'add extra days to cover fridays
'determine the friday after end date
If (Not IncFri) Then
cDays2 = IIf(Weekday(StartDate, vbSunday) = vbFriday, 6, 7)
EndDateWE = EndDate + (cDays2 - Weekday(EndDate, vbSunday))
cDays = cDays + ((EndDateWE - (StartDate + 1)) \ 7)
If Weekday(EndDate, vbSunday) = vbFriday Then cDays = cDays + 1
End If

If (cDays 0) Then
fReEntry = True
EndDate = fWORKDAY(StartDate:=EndDate, _
Days:=cDays, _
Holidays:=Holidays, _
IncFri:=IncFri)
End If

fWORKDAY = EndDate

fReEntry = False

Exit Function

DF_errValue_exit:
fWORKDAY = CVErr(xlErrValue)

End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
This works great. The only problem is that we only work Monday thru

Thusday.
That is why I was using:


=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))

Is there a way to accomplish both 4 day work weeks and skipping the

holidays?

Thank you,

Aviator


"Bob Phillips" wrote:

Aviator,

Why not just WORKDAY

=IF(D$6="","",workday(D6,1,holidays))

where holidays is the holidays range

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
The following formula works well it just does not exclude the

holidays.

Calendar Formula without Weekends (Col. E)


=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)


=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D

$23+1+(WEEKDAY(D$23+1)2)*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.


=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D
$40+1)+2,D$40+1))
3.


=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E
$40+1)+2,E$40+1))
4.


=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F
$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator






  #5   Report Post  
Aviator
 
Posts: n/a
Default

I am not sure what UDF is. Were would I put this information?



"Bob Phillips" wrote:

Aviator,

It can be done with formulae, but they can be very complex. I prefer to have
a UDF that does it. This is such a UDF that I have adapted from one of my
date UDFs. You would use it like so

=fWORKDAY(D$5,1,holidays,FALSE)

The last FALSE is important otherwise it just works like a normal WORKDAY
function.

'---------------------------------------------------------------------
Function fWORKDAY(StartDate As Variant, _
Days As Variant, _
Optional Holidays, _
Optional IncFri As Boolean = True)

'---------------------------------------------------------------------
Dim cDays As Long, cDays2 As Long
Dim StartDateWe As Date, EndDate As Date, EndDateWE As Date

Application.Volatile

'check if valid arguments
If (Not IsDate(StartDate)) Then
GoTo DF_errValue_exit
ElseIf (Not IsNumeric(Days)) Then
GoTo DF_errValue_exit
ElseIf Days < 1 Or IsEmpty(Days) Then
GoTo DF_errValue_exit
ElseIf (Not IsMissing(Holidays)) Then
If (TypeName(Holidays) < "Range" And _
TypeName(Holidays) < "String()" And _
TypeName(Holidays) < "Variant()") Then
GoTo DF_errValue_exit
End If
End If

#If fDebug Then
Debug.Print StartDate & ", " & _
Days & ", " & _
IncSat & ", " & _
IncSun
#End If

EndDate = Application.Run("ATPVBAEN.XLA!WORKDAY", StartDate, Days,
Holidays)

'add extra days to cover fridays
'determine the friday after end date
If (Not IncFri) Then
cDays2 = IIf(Weekday(StartDate, vbSunday) = vbFriday, 6, 7)
EndDateWE = EndDate + (cDays2 - Weekday(EndDate, vbSunday))
cDays = cDays + ((EndDateWE - (StartDate + 1)) \ 7)
If Weekday(EndDate, vbSunday) = vbFriday Then cDays = cDays + 1
End If

If (cDays 0) Then
fReEntry = True
EndDate = fWORKDAY(StartDate:=EndDate, _
Days:=cDays, _
Holidays:=Holidays, _
IncFri:=IncFri)
End If

fWORKDAY = EndDate

fReEntry = False

Exit Function

DF_errValue_exit:
fWORKDAY = CVErr(xlErrValue)

End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
This works great. The only problem is that we only work Monday thru

Thusday.
That is why I was using:


=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))

Is there a way to accomplish both 4 day work weeks and skipping the

holidays?

Thank you,

Aviator


"Bob Phillips" wrote:

Aviator,

Why not just WORKDAY

=IF(D$6="","",workday(D6,1,holidays))

where holidays is the holidays range

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
The following formula works well it just does not exclude the

holidays.

Calendar Formula without Weekends (Col. E)


=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)


=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D

$23+1+(WEEKDAY(D$23+1)2)*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.


=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D
$40+1)+2,D$40+1))
3.


=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E
$40+1)+2,E$40+1))
4.


=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F
$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator









  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default

A UDF is a Used Defined Function. This is VBA, so it goes into a standard
code module. Go into the VBE (Alt-F11), insert a code module (menu
InsertModule), and paste that code into it.

You just use it as any other worksheet function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
I am not sure what UDF is. Were would I put this information?



"Bob Phillips" wrote:

Aviator,

It can be done with formulae, but they can be very complex. I prefer to

have
a UDF that does it. This is such a UDF that I have adapted from one of

my
date UDFs. You would use it like so

=fWORKDAY(D$5,1,holidays,FALSE)

The last FALSE is important otherwise it just works like a normal

WORKDAY
function.

'---------------------------------------------------------------------
Function fWORKDAY(StartDate As Variant, _
Days As Variant, _
Optional Holidays, _
Optional IncFri As Boolean = True)

'---------------------------------------------------------------------
Dim cDays As Long, cDays2 As Long
Dim StartDateWe As Date, EndDate As Date, EndDateWE As Date

Application.Volatile

'check if valid arguments
If (Not IsDate(StartDate)) Then
GoTo DF_errValue_exit
ElseIf (Not IsNumeric(Days)) Then
GoTo DF_errValue_exit
ElseIf Days < 1 Or IsEmpty(Days) Then
GoTo DF_errValue_exit
ElseIf (Not IsMissing(Holidays)) Then
If (TypeName(Holidays) < "Range" And _
TypeName(Holidays) < "String()" And _
TypeName(Holidays) < "Variant()") Then
GoTo DF_errValue_exit
End If
End If

#If fDebug Then
Debug.Print StartDate & ", " & _
Days & ", " & _
IncSat & ", " & _
IncSun
#End If

EndDate = Application.Run("ATPVBAEN.XLA!WORKDAY", StartDate, Days,
Holidays)

'add extra days to cover fridays
'determine the friday after end date
If (Not IncFri) Then
cDays2 = IIf(Weekday(StartDate, vbSunday) = vbFriday, 6, 7)
EndDateWE = EndDate + (cDays2 - Weekday(EndDate, vbSunday))
cDays = cDays + ((EndDateWE - (StartDate + 1)) \ 7)
If Weekday(EndDate, vbSunday) = vbFriday Then cDays = cDays + 1
End If

If (cDays 0) Then
fReEntry = True
EndDate = fWORKDAY(StartDate:=EndDate, _
Days:=cDays, _
Holidays:=Holidays, _
IncFri:=IncFri)
End If

fWORKDAY = EndDate

fReEntry = False

Exit Function

DF_errValue_exit:
fWORKDAY = CVErr(xlErrValue)

End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
This works great. The only problem is that we only work Monday thru

Thusday.
That is why I was using:



=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))

Is there a way to accomplish both 4 day work weeks and skipping the

holidays?

Thank you,

Aviator


"Bob Phillips" wrote:

Aviator,

Why not just WORKDAY

=IF(D$6="","",workday(D6,1,holidays))

where holidays is the holidays range

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
The following formula works well it just does not exclude the

holidays.

Calendar Formula without Weekends (Col. E)



=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)



=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D


$23+1+(WEEKDAY(D$23+1)2)*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.



=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D
$40+1)+2,D$40+1))
3.



=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E
$40+1)+2,E$40+1))
4.



=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F
$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator









  #7   Report Post  
Aviator
 
Posts: n/a
Default

I must be missing something. I have done as you said and all I get is Name
Errors.
Do you have any other ideas?

Thank you,

Aviator

"Bob Phillips" wrote:

A UDF is a Used Defined Function. This is VBA, so it goes into a standard
code module. Go into the VBE (Alt-F11), insert a code module (menu
InsertModule), and paste that code into it.

You just use it as any other worksheet function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
I am not sure what UDF is. Were would I put this information?



"Bob Phillips" wrote:

Aviator,

It can be done with formulae, but they can be very complex. I prefer to

have
a UDF that does it. This is such a UDF that I have adapted from one of

my
date UDFs. You would use it like so

=fWORKDAY(D$5,1,holidays,FALSE)

The last FALSE is important otherwise it just works like a normal

WORKDAY
function.

'---------------------------------------------------------------------
Function fWORKDAY(StartDate As Variant, _
Days As Variant, _
Optional Holidays, _
Optional IncFri As Boolean = True)

'---------------------------------------------------------------------
Dim cDays As Long, cDays2 As Long
Dim StartDateWe As Date, EndDate As Date, EndDateWE As Date

Application.Volatile

'check if valid arguments
If (Not IsDate(StartDate)) Then
GoTo DF_errValue_exit
ElseIf (Not IsNumeric(Days)) Then
GoTo DF_errValue_exit
ElseIf Days < 1 Or IsEmpty(Days) Then
GoTo DF_errValue_exit
ElseIf (Not IsMissing(Holidays)) Then
If (TypeName(Holidays) < "Range" And _
TypeName(Holidays) < "String()" And _
TypeName(Holidays) < "Variant()") Then
GoTo DF_errValue_exit
End If
End If

#If fDebug Then
Debug.Print StartDate & ", " & _
Days & ", " & _
IncSat & ", " & _
IncSun
#End If

EndDate = Application.Run("ATPVBAEN.XLA!WORKDAY", StartDate, Days,
Holidays)

'add extra days to cover fridays
'determine the friday after end date
If (Not IncFri) Then
cDays2 = IIf(Weekday(StartDate, vbSunday) = vbFriday, 6, 7)
EndDateWE = EndDate + (cDays2 - Weekday(EndDate, vbSunday))
cDays = cDays + ((EndDateWE - (StartDate + 1)) \ 7)
If Weekday(EndDate, vbSunday) = vbFriday Then cDays = cDays + 1
End If

If (cDays 0) Then
fReEntry = True
EndDate = fWORKDAY(StartDate:=EndDate, _
Days:=cDays, _
Holidays:=Holidays, _
IncFri:=IncFri)
End If

fWORKDAY = EndDate

fReEntry = False

Exit Function

DF_errValue_exit:
fWORKDAY = CVErr(xlErrValue)

End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
This works great. The only problem is that we only work Monday thru
Thusday.
That is why I was using:



=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))

Is there a way to accomplish both 4 day work weeks and skipping the
holidays?

Thank you,

Aviator


"Bob Phillips" wrote:

Aviator,

Why not just WORKDAY

=IF(D$6="","",workday(D6,1,holidays))

where holidays is the holidays range

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
The following formula works well it just does not exclude the
holidays.

Calendar Formula without Weekends (Col. E)



=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)



=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D


$23+1+(WEEKDAY(D$23+1)2)*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.



=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D
$40+1)+2,D$40+1))
3.



=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E
$40+1)+2,E$40+1))
4.



=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F
$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator










  #8   Report Post  
Bob Phillips
 
Posts: n/a
Default

#Name means it cannot find the UDF, thus it seems that you have done
something incorrectly. Without seeing what you have done, I am stumped.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
I must be missing something. I have done as you said and all I get is Name
Errors.
Do you have any other ideas?

Thank you,

Aviator

"Bob Phillips" wrote:

A UDF is a Used Defined Function. This is VBA, so it goes into a

standard
code module. Go into the VBE (Alt-F11), insert a code module (menu
InsertModule), and paste that code into it.

You just use it as any other worksheet function.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
I am not sure what UDF is. Were would I put this information?



"Bob Phillips" wrote:

Aviator,

It can be done with formulae, but they can be very complex. I prefer

to
have
a UDF that does it. This is such a UDF that I have adapted from one

of
my
date UDFs. You would use it like so

=fWORKDAY(D$5,1,holidays,FALSE)

The last FALSE is important otherwise it just works like a normal

WORKDAY
function.


'---------------------------------------------------------------------
Function fWORKDAY(StartDate As Variant, _
Days As Variant, _
Optional Holidays, _
Optional IncFri As Boolean = True)


'---------------------------------------------------------------------
Dim cDays As Long, cDays2 As Long
Dim StartDateWe As Date, EndDate As Date, EndDateWE As Date

Application.Volatile

'check if valid arguments
If (Not IsDate(StartDate)) Then
GoTo DF_errValue_exit
ElseIf (Not IsNumeric(Days)) Then
GoTo DF_errValue_exit
ElseIf Days < 1 Or IsEmpty(Days) Then
GoTo DF_errValue_exit
ElseIf (Not IsMissing(Holidays)) Then
If (TypeName(Holidays) < "Range" And _
TypeName(Holidays) < "String()" And _
TypeName(Holidays) < "Variant()") Then
GoTo DF_errValue_exit
End If
End If

#If fDebug Then
Debug.Print StartDate & ", " & _
Days & ", " & _
IncSat & ", " & _
IncSun
#End If

EndDate = Application.Run("ATPVBAEN.XLA!WORKDAY", StartDate,

Days,
Holidays)

'add extra days to cover fridays
'determine the friday after end date
If (Not IncFri) Then
cDays2 = IIf(Weekday(StartDate, vbSunday) = vbFriday, 6, 7)
EndDateWE = EndDate + (cDays2 - Weekday(EndDate, vbSunday))
cDays = cDays + ((EndDateWE - (StartDate + 1)) \ 7)
If Weekday(EndDate, vbSunday) = vbFriday Then cDays = cDays

+ 1
End If

If (cDays 0) Then
fReEntry = True
EndDate = fWORKDAY(StartDate:=EndDate, _
Days:=cDays, _
Holidays:=Holidays, _
IncFri:=IncFri)
End If

fWORKDAY = EndDate

fReEntry = False

Exit Function

DF_errValue_exit:
fWORKDAY = CVErr(xlErrValue)

End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
This works great. The only problem is that we only work Monday

thru
Thusday.
That is why I was using:




=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))

Is there a way to accomplish both 4 day work weeks and skipping

the
holidays?

Thank you,

Aviator


"Bob Phillips" wrote:

Aviator,

Why not just WORKDAY

=IF(D$6="","",workday(D6,1,holidays))

where holidays is the holidays range

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Aviator" wrote in message
...
The following formula works well it just does not exclude the
holidays.

Calendar Formula without Weekends (Col. E)




=IF(D$6="","",IF(WEEKDAY(D$6+1,2)4,D$6+1+(WEEKDAY (D$6+1)2)*7-WEEKDAY(D$6+1
)+2,D$6+1))


I can not get this to work.

Calendar Formula without Weekends & Holidays (Col. E)




=IF(NETWORKDAYS(D$23,D$23,AZ2:AZ27)=1,IF(D$23=""," ",IF(WEEKDAY(D$23+1,2)4,D



$23+1+(WEEKDAY(D$23+1)2)*7-WEEKDAY(D$23+1)+2,D$23+1)),"Weekend/Holiday")


The following is how I have things set up.

Formula:
1. Input date scheduled to start: 12/23
2.




=IF(D$40="","",IF(WEEKDAY(D$40+1,2)4,D$40+1+(WEEK DAY(D$40+1)2)*7-WEEKDAY(D
$40+1)+2,D$40+1))
3.




=IF(E$40="","",IF(WEEKDAY(E$40+1,2)4,E$40+1+(WEEK DAY(E$40+1)2)*7-WEEKDAY(E
$40+1)+2,E$40+1))
4.




=IF(F$40="","",IF(WEEKDAY(F$40+1,2)4,F$40+1+(WEEK DAY(F$40+1)2)*7-WEEKDAY(F
$40+1)+2,F$40+1))

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,

Aviator












  #9   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Wed, 12 Jan 2005 04:25:03 -0800, "Aviator"
wrote:

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,


If I understand you correctly, you wish to generate a list of successive dates
which excludes Fridays, Saturdays, Sundays and holidays.

If you have the Analysis Tool Pak installed, you can use a slight modification
of the Workday function:

=workday(D40+(WEEKDAY(D40)=5),1,Holidays)

where Holidays is the range where you have stored a list of holidays.

You can, of course, "wrap" this in your IF statement:

=IF(D40="","",workday(D40+(WEEKDAY(D4)=5),1,Holida ys))


--ron
  #10   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Wed, 12 Jan 2005 20:15:37 -0500, Ron Rosenfeld
wrote:

On Wed, 12 Jan 2005 04:25:03 -0800, "Aviator"
wrote:

What I have currently:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 12/27 12/28 12/29


This is the way I want it to look like.

Wanting to Skip Weekends & Holidays:
1 2 3 4
Col. D Col. E Col. F Col. G
12/23 1/3 1/4 1/5

Formula:
1 Input date scheduled to start: 12/23
2 ?
3 ?
4 ?

Note: AZ2:AZ25 are the listed holidays


Please Help! Thank you,


If I understand you correctly, you wish to generate a list of successive dates
which excludes Fridays, Saturdays, Sundays and holidays.

If you have the Analysis Tool Pak installed, you can use a slight modification
of the Workday function:

=workday(D40+(WEEKDAY(D40)=5),1,Holidays)

where Holidays is the range where you have stored a list of holidays.

You can, of course, "wrap" this in your IF statement:

=IF(D40="","",workday(D40+(WEEKDAY(D4)=5),1,Holid ays))


--ron


TYPO Alert: with the IF, should read:

=IF(D40="","",workday(D40+(WEEKDAY(D40)=5),1,Holid ays))


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Skip blank cells in diagrams hlp Charts and Charting in Excel 9 February 24th 06 02:32 PM
Skip the holidays Aviator Excel Discussion (Misc queries) 6 January 11th 05 08:13 PM
skip alert msg A Excel Discussion (Misc queries) 7 January 6th 05 02:57 PM
Conditional Format Holidays GregR Excel Discussion (Misc queries) 2 December 15th 04 05:26 PM
how to skip the blank cells nayeemoddin Excel Discussion (Misc queries) 1 December 6th 04 07:07 AM


All times are GMT +1. The time now is 06:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"