Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default formula for programing end dates

I'm looking for the formula to do the following: to project a date in the
future. this date can "only" be on a Friday, Saturday or Sunday. sample:
I'm off work Friday thru Sunday, I take a part time job that will last 72
days. what would the completion date be? I have been unable to figure the
formula. can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default formula for programing end dates

Function EndDate(StartDate As Date, Optional hours As Long = 72) As Date
EndDate = DateAdd("h", hours, StartDate)
Do While Weekday(EndDate, vbMonday) < 5
EndDate = EndDate + 1
Loop
End Function

"warren" wrote:

I'm looking for the formula to do the following: to project a date in the
future. this date can "only" be on a Friday, Saturday or Sunday. sample:
I'm off work Friday thru Sunday, I take a part time job that will last 72
days. what would the completion date be? I have been unable to figure the
formula. can anyone help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default formula for programing end dates

Here is a formula solution which caters for holidays as well

=start_date+SIGN(B1)*SMALL(IF((WEEKDAY(start_date+ SIGN(days)*(ROW(INDIRECT("
1:"&ABS(days)*10))))={2,3,4,5})*ISNA(MATCH(start_d ate+SIGN(days)*(ROW(INDIRE
CT("1:"&ABS(days)*10))),holidays,0)),ROW(INDIRECT( "1:"&ABS(days)*10))),ABS(d
ays))

This is an array formula so commit with Ctrl-Shift-Enter.

Holidays is a range of holiday dates, it can be empty but it must be
defined.

--

HTH

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


"warren" wrote in message
...
I'm looking for the formula to do the following: to project a date in the
future. this date can "only" be on a Friday, Saturday or Sunday. sample:
I'm off work Friday thru Sunday, I take a part time job that will last 72
days. what would the completion date be? I have been unable to figure the
formula. can anyone help?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default formula for programing end dates

I tried both Patrick and Bob's formula but I could not get them to work.
I'm still looking for help.....please

"warren" wrote:

I'm looking for the formula to do the following: to project a date in the
future. this date can "only" be on a Friday, Saturday or Sunday. sample:
I'm off work Friday thru Sunday, I take a part time job that will last 72
days. what would the completion date be? I have been unable to figure the
formula. can anyone help?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default formula for programing end dates

Warren,

mine might have suffered from NG wrap-around, so check it carefully.

What data did you use, and what result did you get?

--

HTH

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


"warren" wrote in message
...
I tried both Patrick and Bob's formula but I could not get them to work.
I'm still looking for help.....please

"warren" wrote:

I'm looking for the formula to do the following: to project a date in

the
future. this date can "only" be on a Friday, Saturday or Sunday.

sample:
I'm off work Friday thru Sunday, I take a part time job that will last

72
days. what would the completion date be? I have been unable to figure

the
formula. can anyone help?





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default formula for programing end dates

.... oh, and did you replace start_date, days and holidays or create range
names for these?

--

HTH

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


"warren" wrote in message
...
I tried both Patrick and Bob's formula but I could not get them to work.
I'm still looking for help.....please

"warren" wrote:

I'm looking for the formula to do the following: to project a date in

the
future. this date can "only" be on a Friday, Saturday or Sunday.

sample:
I'm off work Friday thru Sunday, I take a part time job that will last

72
days. what would the completion date be? I have been unable to figure

the
formula. can anyone help?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default formula for programing end dates

I loaded just as you wrote it double checked it. in the box where the answer
should have been was "#name"

=start_date+SIGN(B1)*SMALL(IF((WEEKDAY(start_date+ SIGN(days)*(ROW(INDIRECT("
1:"&ABS(days)*10))))={2,3,4,5})*ISNA(MATCH(start_d ate+SIGN(days)*(ROW(INDIRE
CT("1:"&ABS(days)*10))),holidays,0)),ROW(INDIRECT( "1:"&ABS(days)*10))),ABS(d
ays))


Bob I give you another sample of what I'm looking for:

I'm going to jail and only serve on weekends (friday thru Sunday) I have to
serve (?) days when do I get out?

thanks for any help...Warren


"Bob Phillips" wrote:

Warren,

mine might have suffered from NG wrap-around, so check it carefully.

What data did you use, and what result did you get?

--

HTH

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


"warren" wrote in message
...
I tried both Patrick and Bob's formula but I could not get them to work.
I'm still looking for help.....please

"warren" wrote:

I'm looking for the formula to do the following: to project a date in

the
future. this date can "only" be on a Friday, Saturday or Sunday.

sample:
I'm off work Friday thru Sunday, I take a part time job that will last

72
days. what would the completion date be? I have been unable to figure

the
formula. can anyone help?




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
Macro Programing ¿Confused? New Users to Excel 13 March 8th 07 07:23 PM
Proper Programing Tim Excel Programming 1 November 19th 04 03:17 PM
VB programing Mestrella31 Excel Programming 3 October 11th 04 03:05 PM
Help with VBA programing CyberStorm Excel Programming 3 July 26th 04 07:57 PM
help with excel programing drummerboy827[_4_] Excel Programming 1 September 27th 03 03:31 PM


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