Workday fxn not recognizing Sat/Sun/Holiday start

J

jforbes

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??
 
B

Bob Phillips

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)
 
J

jforbes

I feel like kicking myself! It worked, thanks!

Bob Phillips said:
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)
 

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