Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Workday fxn not recognizing Sat/Sun/Holiday start

I have a macro which accepts a month and year and inserts the first day of
the month (ex. passed Oct 2007, inserts 10/1/07) into a cell. I then have
the macro calculating the day number of certain working days after the
starting day using this:

=DAY(WORKDAY(Holidays!R1C3,0,Holidays!R2C1:R18C1)

where Holidays!R1C3 is my first day of the month, 0 would be the first
working day of the month, and Holidays!R2C1:R18C1 would be my holiday list.
This works just fine when the first day of the month isn't on a weekend or on
the list of holidays; but when it is on a weekend, I have built in this
conditional:

If Weekday(startday) < 1 Or Weekday(startday) < 7 Then
=DAY(WORKDAY(Holidays!R1C3,1,Holidays!R2C1:R18C1)

where startday is also the first day of the month. I have tried this:

If "=Weekday(Holidays!R1C3,1) < 1" Or "=Weekday(Holidays!R1C3,1) <7" Then

but only get an error back when it hits this point.

The issue I'm having is that it seems to be ignoring my If statement for
when the first day of the month is a weekend and calling that Saturday or
Sunday the first working day. What am I doing wrong??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Workday fxn not recognizing Sat/Sun/Holiday start

Try this

=DAY(WORKDAY(Holidays!R1C3-1,1,Holidays!R2C1:R18C1))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"jforbes" wrote in message
...
I have a macro which accepts a month and year and inserts the first day of
the month (ex. passed Oct 2007, inserts 10/1/07) into a cell. I then have
the macro calculating the day number of certain working days after the
starting day using this:

=DAY(WORKDAY(Holidays!R1C3,0,Holidays!R2C1:R18C1)

where Holidays!R1C3 is my first day of the month, 0 would be the first
working day of the month, and Holidays!R2C1:R18C1 would be my holiday
list.
This works just fine when the first day of the month isn't on a weekend or
on
the list of holidays; but when it is on a weekend, I have built in this
conditional:

If Weekday(startday) < 1 Or Weekday(startday) < 7 Then
=DAY(WORKDAY(Holidays!R1C3,1,Holidays!R2C1:R18C1)

where startday is also the first day of the month. I have tried this:

If "=Weekday(Holidays!R1C3,1) < 1" Or "=Weekday(Holidays!R1C3,1) <7"
Then

but only get an error back when it hits this point.

The issue I'm having is that it seems to be ignoring my If statement for
when the first day of the month is a weekend and calling that Saturday or
Sunday the first working day. What am I doing wrong??



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Workday fxn not recognizing Sat/Sun/Holiday start

I feel like kicking myself! It worked, thanks!

"Bob Phillips" wrote:

Try this

=DAY(WORKDAY(Holidays!R1C3-1,1,Holidays!R2C1:R18C1))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"jforbes" wrote in message
...
I have a macro which accepts a month and year and inserts the first day of
the month (ex. passed Oct 2007, inserts 10/1/07) into a cell. I then have
the macro calculating the day number of certain working days after the
starting day using this:

=DAY(WORKDAY(Holidays!R1C3,0,Holidays!R2C1:R18C1)

where Holidays!R1C3 is my first day of the month, 0 would be the first
working day of the month, and Holidays!R2C1:R18C1 would be my holiday
list.
This works just fine when the first day of the month isn't on a weekend or
on
the list of holidays; but when it is on a weekend, I have built in this
conditional:

If Weekday(startday) < 1 Or Weekday(startday) < 7 Then
=DAY(WORKDAY(Holidays!R1C3,1,Holidays!R2C1:R18C1)

where startday is also the first day of the month. I have tried this:

If "=Weekday(Holidays!R1C3,1) < 1" Or "=Weekday(Holidays!R1C3,1) <7"
Then

but only get an error back when it hits this point.

The issue I'm having is that it seems to be ignoring my If statement for
when the first day of the month is a weekend and calling that Saturday or
Sunday the first working day. What am I doing wrong??




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
Add no. of days to a workday to get new workday? blswes Excel Worksheet Functions 1 April 15th 10 07:39 PM
In WORKDAY function, how to exclude multiple/variable holiday rang Harold Shea Excel Discussion (Misc queries) 4 August 3rd 09 06:53 PM
how do I add words, holiday =1, holiday am=0.5 GCC Excel Worksheet Functions 2 March 6th 07 03:53 PM
Holiday Planner show holiday taken? Mac5 Excel Worksheet Functions 0 July 18th 06 11:29 PM
OT :Start your own online business today !start making dollars [email protected] Excel Discussion (Misc queries) 0 May 6th 06 09:29 PM


All times are GMT +1. The time now is 04:53 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"