Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Add no. of days to a workday to get new workday? | Excel Worksheet Functions | |||
In WORKDAY function, how to exclude multiple/variable holiday rang | Excel Discussion (Misc queries) | |||
how do I add words, holiday =1, holiday am=0.5 | Excel Worksheet Functions | |||
Holiday Planner show holiday taken? | Excel Worksheet Functions | |||
OT :Start your own online business today !start making dollars | Excel Discussion (Misc queries) |