Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
keith m
 
Posts: n/a
Default "Saturday as a work day?

I am using the formula "=Workday" but I want this formula to include
Saturdays. I have a Start Date and a duration and want to calculate the end
date with Saturday included as a work day. Can anyone tell me how to do
this? Any assistance would be greatly appreciated. Thank you.
  #2   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Thu, 11 Aug 2005 12:00:20 -0700, "keith m" <keith
wrote:

I am using the formula "=Workday" but I want this formula to include
Saturdays. I have a Start Date and a duration and want to calculate the end
date with Saturday included as a work day. Can anyone tell me how to do
this? Any assistance would be greatly appreciated. Thank you.


Here is a UDF (User Defined Function) that will accomplish that.

To enter this function, <alt<F11 opens the Visual Basic Editor. Ensure your
project is highlighted in the Project Explorer window, then Insert/Module and
paste the code below into the window that opens.

To use the function, in some cell enter the formula:

=WDincSat(Start,NumDays,Holidays)

The variables can be cell references or entered directly. The Holidays
argument can be a range; but it is optional.

====================================
Function WDincSat(StartDate As Date, ByVal NumDays As Long, _
Optional Holidays As Range = Nothing) As Date

'Workday function without Analysis Toolpak

Dim i As Long
Dim TempDate As Date
Dim c As Range
Dim Stp As Integer

Stp = Sgn(NumDays)
TempDate = StartDate
For i = Stp To NumDays Step Stp
TempDate = TempDate + Stp
If Weekday(TempDate) = vbSunday Then _
TempDate = TempDate + Stp + (Stp < 0)

If Not Holidays Is Nothing Then
Do Until Not IsError(Application.Match(CDbl(TempDate), Holidays, 0)) = False
If IsError(Application.Match(CDbl(TempDate), Holidays, 0)) = False Then
TempDate = TempDate + Stp
If Weekday(TempDate) = vbSunday Then _
TempDate = TempDate + Stp + (Stp < 0)
End If
Loop
End If
Next i

WDincSat = TempDate
End Function
========================================



HTH,
--ron
  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

=start_date+IF(days=0,0,SIGN(days)*SMALL(IF((WEEKD AY(start_date+SIGN(days)*(
ROW(INDIRECT("1:"&ABS(days)*10))),2)<7)*ISNA(MATCH (start_date+SIGN(days)*(RO
W(INDIRECT("1:"&ABS(days)*10))),holidays,0)),ROW(I NDIRECT("1:"&ABS(days)*10)
)),ABS(days)))

start_date, days, and holidays are named ranged here.

It is an arary formula so commit with Ctrl-Shift-Enter

--

HTH

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


"keith m" <keith wrote in message
...
I am using the formula "=Workday" but I want this formula to include
Saturdays. I have a Start Date and a duration and want to calculate the

end
date with Saturday included as a work day. Can anyone tell me how to do
this? Any assistance would be greatly appreciated. Thank you.



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

On Thu, 11 Aug 2005 20:50:53 +0100, "Bob Phillips"
wrote:

=start_date+IF(days=0,0,SIGN(days)*SMALL(IF((WEEK DAY(start_date+SIGN(days)*(
ROW(INDIRECT("1:"&ABS(days)*10))),2)<7)*ISNA(MATC H(start_date+SIGN(days)*(RO
W(INDIRECT("1:"&ABS(days)*10))),holidays,0)),ROW( INDIRECT("1:"&ABS(days)*10)
)),ABS(days)))

start_date, days, and holidays are named ranged here.

It is an arary formula so commit with Ctrl-Shift-Enter


Your formula is handy, but will give a REF error if days6553. I believe that
is because the ROW(INDIRECT("1: ...) gives a result of greater than 65536 for
the second factor, which would result in an invalid cell reference.


--ron
  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

That is very true Ron, and must be for the reason you state. I will add that
to the text in future.

--

HTH

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


"Ron Rosenfeld" wrote in message
...
On Thu, 11 Aug 2005 20:50:53 +0100, "Bob Phillips"
wrote:


=start_date+IF(days=0,0,SIGN(days)*SMALL(IF((WEEK DAY(start_date+SIGN(days)*

(

ROW(INDIRECT("1:"&ABS(days)*10))),2)<7)*ISNA(MATC H(start_date+SIGN(days)*(R

O

W(INDIRECT("1:"&ABS(days)*10))),holidays,0)),ROW( INDIRECT("1:"&ABS(days)*10

)
)),ABS(days)))

start_date, days, and holidays are named ranged here.

It is an arary formula so commit with Ctrl-Shift-Enter


Your formula is handy, but will give a REF error if days6553. I believe

that
is because the ROW(INDIRECT("1: ...) gives a result of greater than 65536

for
the second factor, which would result in an invalid cell reference.


--ron





  #6   Report Post  
Giovanni D via OfficeKB.com
 
Posts: n/a
Default

Hi Sir this is Gio from Philippines...... it's my first time here in
this site... i am wondering how can i solve this problem in excel and please
help me.. I used excel 2000 in creating an inventory program in the hospital.
I used this excel inventorry program in our suppply room, i used one
worksheet per item. and i have almost 300 items in the supply room or almost
300 worksheets. I saved it as a template for all i know it is safer to save
it as template rather than saving it as ordinary excel files. The program was
working well, but not when i started linking(hyperlink) it from a certain
file that i always used. Then i have save it several times as a template but
i notice that the program malfuncitons, it doesnt compute the formulas i
created and some formulas are gone. Why is this happening. when i add some
items in the inventory it wouldnt add to the current balance, why is this
happening? Will you please help me, you wer the only people who can only
help me with this kind of problem......please....
  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default

Gio,

Re-post this as a new thread, it will get lost tagged onto this thread.

--

HTH

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


"Giovanni D via OfficeKB.com" wrote in message
...
Hi Sir this is Gio from Philippines...... it's my first time here in
this site... i am wondering how can i solve this problem in excel and

please
help me.. I used excel 2000 in creating an inventory program in the

hospital.
I used this excel inventorry program in our suppply room, i used one
worksheet per item. and i have almost 300 items in the supply room or

almost
300 worksheets. I saved it as a template for all i know it is safer to

save
it as template rather than saving it as ordinary excel files. The program

was
working well, but not when i started linking(hyperlink) it from a certain
file that i always used. Then i have save it several times as a template

but
i notice that the program malfuncitons, it doesnt compute the formulas i
created and some formulas are gone. Why is this happening. when i add some
items in the inventory it wouldnt add to the current balance, why is this
happening? Will you please help me, you wer the only people who can only
help me with this kind of problem......please....



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
Work book formulas Jessica Excel Discussion (Misc queries) 1 June 9th 05 10:51 AM
How to copy the work sheets from different workbooks into one? Sesh Excel Discussion (Misc queries) 1 April 15th 05 06:03 PM
Starting work period on a Saturday and ending on a friday JLyons Excel Worksheet Functions 3 February 18th 05 01:13 PM
Starting work period on a Saturday and ending on a friday JLyons Excel Discussion (Misc queries) 1 February 17th 05 02:28 PM
I really need help! Changing work period start dates JLyons Excel Worksheet Functions 0 February 16th 05 01:19 PM


All times are GMT +1. The time now is 05:42 PM.

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"