Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 48
Default date and time [skipping weekends]

I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,345
Default date and time [skipping weekends]

Try:

=NOW()+A3+CHOOSE(WEEKDAY(NOW()+A3,2),0,0,0,0,0,2,1 )

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"rhhince" wrote in message
...
I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default date and time [skipping weekends]

On Sat, 29 Mar 2008 13:42:34 -0700 (PDT), rhhince
wrote:

I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?



Please specify you problem with more details.
What do you mean by "skip the weekend ... in the addition"?

Do you want the result to be "rounded" up to Sunday 16:00 if the
result of NOW()+A3 falls within the "weekend"?
Or do you want to just add 2 days to the result in that case?
And what if A3 is more than 7 (one week), e.g 50?
Do you want to add 2 days for each weekend covered by the A3 days?

/ Lars-Åke

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 141
Default date and time [skipping weekends]

Hi,

This is assuming that you want to add x days to the date in cell A5
(replace with Now() if necessary) and assuming that number of days to
add is in cell D5.
It also assumes that I understand your question correctly... as I see
it you want to add a number of days and skip and weekends. ie. If it's
Thursday and you want to add 4 days, you would expect the result to be
Wednesday the following week and so on.

=A5+IF(D55-WEEKDAY(A5,2),INT((D5+WEEKDAY(A5,3))/5)*2+D5,D5)

There is a good chance that this can be optimised... haven't looked at
that yet. The one thing to be aware of is that this formula will
glitch if the date you are adding to is in fact a weekend... in which
case you might need to wrap another if around it to test for that.

Cheers,
Ivan.

On Mar 30, 9:20*am, Lars-Åke Aspelin
wrote:
On Sat, 29 Mar 2008 13:42:34 -0700 (PDT), rhhince
wrote:

I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?


Please specify you problem with more details.
What do you mean by "skip the weekend ... in the addition"?

Do you want the result to be "rounded" up to Sunday 16:00 if the
result of NOW()+A3 falls within the "weekend"?
Or do you want to just add 2 days to the result in that case?
And what if A3 is more than 7 (one week), e.g 50?
Do you want to add 2 days for each weekend covered by the A3 days?

/ Lars-Åke


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 48
Default date and time [skipping weekends]

This worked very well. Thank you!
The reason I wanted this function is I trade forex and my spreadsheet
formulas suggest trading time frames which do not include weekends,
therefore I need to skip weekends as there is no trading. So, for
example, if a signal came on a Thurs. indicating that a change in 3
days could occur, under normal counting that would be on Sunday. I
have to skip weekends, therefore the signal should come on Tues.
Anyways, it works well and gives a better idea without having to look
at a calendar.
Thanks again.

On Mar 29, 4:19 pm, "Sandy Mann" wrote:
Try:

=NOW()+A3+CHOOSE(WEEKDAY(NOW()+A3,2),0,0,0,0,0,2,1 )

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk

"rhhince" wrote in message

...

I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 48
Default date and time [skipping weekends]

This worked very well.

=NOW()+A3+CHOOSE(WEEKDAY(NOW()+A3,2),0,0,0,0,0,2,1 )




On Mar 30, 1:04 am, rhhince wrote:
This worked very well. Thank you!
The reason I wanted this function is I trade forex and my spreadsheet
formulas suggest trading time frames which do not include weekends,
therefore I need to skip weekends as there is no trading. So, for
example, if a signal came on a Thurs. indicating that a change in 3
days could occur, under normal counting that would be on Sunday. I
have to skip weekends, therefore the signal should come on Tues.
Anyways, it works well and gives a better idea without having to look
at a calendar.
Thanks again.

On Mar 29, 4:19 pm, "Sandy Mann" wrote:

Try:


=NOW()+A3+CHOOSE(WEEKDAY(NOW()+A3,2),0,0,0,0,0,2,1 )


--
HTH


Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings



Replace @mailinator.com with @tiscali.co.uk


"rhhince" wrote in message


...


I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default date and time [skipping weekends]

Give this function a try...

=WORKDAY(NOW(),A3)

Note 1: If this function is not available, and returns the #NAME? error,
install and load the Analysis ToolPak add-in.

Note 2: Also check out the help files for this function as there is an
optional 3rd argument which can allow you to skip over holidays as well.

Rick


"rhhince" wrote in message
...
I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 141
Default date and time [skipping weekends]

Hi Rhince,

Although Sandy's formula will in some respect skip some weekends, I
would advise some caution with it. Since you have explained your
situation a little more clearly now, testing the formula with your
exact example (Thurs + 3 working days) actually gives me Monday the
following week (only 2 days by me way of thinking), as will adding 2
days or four days in fact. Just a word or warning.

Cheers,
Ivan.

On Mar 30, 5:07*pm, rhhince wrote:
This worked very well.

=NOW()+A3+CHOOSE(WEEKDAY(NOW()+A3,2),0,0,0,0,0,2,1 )

On Mar 30, 1:04 am, rhhince wrote:



This worked very well. Thank you!
The reason I wanted this function is I trade forex and my spreadsheet
formulas suggest trading time frames which do not include weekends,
therefore I need to skip weekends as there is no trading. So, for
example, if a signal came on a Thurs. indicating that a change in 3
days could occur, under normal counting that would be on Sunday. I
have to skip weekends, therefore the signal should come on Tues.
Anyways, it works well and gives a better idea without having to look
at a calendar.
Thanks again.


On Mar 29, 4:19 pm, "Sandy Mann" wrote:


Try:


=NOW()+A3+CHOOSE(WEEKDAY(NOW()+A3,2),0,0,0,0,0,2,1 )


--
HTH


Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings



Replace @mailinator.com with @tiscali.co.uk


"rhhince" wrote in message


....


I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?- Hide quoted text -


- Show quoted text -


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 48
Default date and time [skipping weekends]

Upon further scenarios, this formula worked the best.
=A5+IF(D55-WEEKDAY(A5,2),INT((D5+WEEKDAY(A5,3))/5)*2+D5,D5)


On Mar 29, 11:32 pm, Ivyleaf wrote:
Hi,

This is assuming that you want to add x days to the date in cell A5
(replace with Now() if necessary) and assuming that number of days to
add is in cell D5.
It also assumes that I understand your question correctly... as I see
it you want to add a number of days and skip and weekends. ie. If it's
Thursday and you want to add 4 days, you would expect the result to be
Wednesday the following week and so on.

=A5+IF(D55-WEEKDAY(A5,2),INT((D5+WEEKDAY(A5,3))/5)*2+D5,D5)

There is a good chance that this can be optimised... haven't looked at
that yet. The one thing to be aware of is that this formula will
glitch if the date you are adding to is in fact a weekend... in which
case you might need to wrap another if around it to test for that.

Cheers,
Ivan.

On Mar 30, 9:20 am, Lars-Åke Aspelin
wrote:

On Sat, 29 Mar 2008 13:42:34 -0700 (PDT), rhhince
wrote:


I have a number in a cell that represents days. I wish to add these
days to the current date and time, which is easy to do. =NOW()+A3
I format it into time displaying date and time.
How can I automatically skip the weekend from Friday 16:00 to Sunday
16:00 which is 48 hours in the addition?


Please specify you problem with more details.
What do you mean by "skip the weekend ... in the addition"?


Do you want the result to be "rounded" up to Sunday 16:00 if the
result of NOW()+A3 falls within the "weekend"?
Or do you want to just add 2 days to the result in that case?
And what if A3 is more than 7 (one week), e.g 50?
Do you want to add 2 days for each weekend covered by the A3 days?


/ Lars-Åke


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
Date/Time Difference Excluding Weekends & Holidays Paula D Excel Worksheet Functions 3 June 29th 12 11:15 PM
subtracting date and time formats excluding weekends Diane13 Excel Worksheet Functions 15 September 1st 09 03:07 AM
Subtracting Dates to get total time work time excluding weekends Jon Ratzel[_2_] Excel Discussion (Misc queries) 2 January 31st 08 10:36 PM
add time with out weekends Aroldo Excel Discussion (Misc queries) 3 November 27th 07 08:03 PM
How do I set up a clumn of days, skipping weekends? Enrique Excel Worksheet Functions 2 March 2nd 06 10:30 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"