Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
TLAngelo
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS

I have created a spreadsheet that calculates process times. If a product is
held overnight, then excel subtracts 14 hours from the total to account for
14 hours that are non-working hours, if a product is held over a weekend,
then excel subtracts 62 hours of non-working time (24x2 for Sat. & Sun. +14
for Fri. night). The problem I am running into is that if a product is held
for 1 or 2 days and those days are NOT weekends, then I only want it to
subtract the 14 hours for however many days.

Also, can you have separate formulas in a cell without nesting them? For
example, an "OR" formula?


  #2   Report Post  
Posted to microsoft.public.excel.misc
jim
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS

To your first question, how about doing something like
=IF(WEEKDAY(A2,2)5,X-14,X-62). WEEKDAY assigns a numeric value,
starting with Monday (with the ",2"). So if it's greater than 5, it's
a weekend (6=SAT and 7=SUN). In the above example, X is equal to the
number of days held. If you want to account for a mix of weekdays and
weekends you might need to get a little more complex, but this should
serve as a start.

I don't think there's an OR operator in Excel -- I've always embedded
my conditionals.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS

What happens if one of the dates is Sat or Sun, is this possible? Can it
span multiple weekends?

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"TLAngelo" wrote in message
...
I have created a spreadsheet that calculates process times. If a product

is
held overnight, then excel subtracts 14 hours from the total to account

for
14 hours that are non-working hours, if a product is held over a weekend,
then excel subtracts 62 hours of non-working time (24x2 for Sat. & Sun.

+14
for Fri. night). The problem I am running into is that if a product is

held
for 1 or 2 days and those days are NOT weekends, then I only want it to
subtract the 14 hours for however many days.

Also, can you have separate formulas in a cell without nesting them? For
example, an "OR" formula?




  #4   Report Post  
Posted to microsoft.public.excel.misc
jim
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS

WEEKDAY should always return a value between 1 and 7. So weekends will
be 6 and 7 (Sat and Sun) if you use the formula above. If you count
anything coded 1-5 as a weekday (14hrs) and anything greater than 5 as
a weekend (24hrs) you should be okay.

Again, if you're looking at counting multiple days you'll need to take
this a little further, but hopefully this will get you started in
determining whether a given date is a weekday or weekend.


Jim

  #5   Report Post  
Posted to microsoft.public.excel.misc
daddylonglegs
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS


Assuming you have a process start time and date in A2 and a process end
time and date in B2 and that these dates/times will always be within
your working hours you could use the following formula to calculate the
total process time

=(NETWORKDAYS(A2,B2)-1)/2.4+MOD(B2,1)-MOD(A2,1)

format as [h]:mm

note that NETWORKDAYS is part of Analysis ToolPak add-in


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=539083



  #6   Report Post  
Posted to microsoft.public.excel.misc
TLAngelo
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS

No, one of the dates will not be a Sat. or Sun. It shouldn't span multiple
weekends. My dates and times "in" are in fields D & E and dates and times
"out" are in fields F & G. So normally, if a product is held for 2 or 3
days, it is because there was a weekend, but sometimes a product may be held
for 2 or 3 days and it is in the middle of the week (that's not good). If it
was a weekend, I want to subtract the whole 24 hours of the days from the
process time, if it was held for that long and it was during the week
however, I only want to subtract the 14 hours of evening non-working time. I
can write the formula to subtract one or the other, but I don't know how to
tell excel to recognize if the holding time includes a weekend or not... is
this clear as mudd??!!

"Bob Phillips" wrote:

What happens if one of the dates is Sat or Sun, is this possible? Can it
span multiple weekends?

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"TLAngelo" wrote in message
...
I have created a spreadsheet that calculates process times. If a product

is
held overnight, then excel subtracts 14 hours from the total to account

for
14 hours that are non-working hours, if a product is held over a weekend,
then excel subtracts 62 hours of non-working time (24x2 for Sat. & Sun.

+14
for Fri. night). The problem I am running into is that if a product is

held
for 1 or 2 days and those days are NOT weekends, then I only want it to
subtract the 14 hours for however many days.

Also, can you have separate formulas in a cell without nesting them? For
example, an "OR" formula?





  #7   Report Post  
Posted to microsoft.public.excel.misc
daddylonglegs
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS


I think you could use the formula I suggested modified to

=(NETWORKDAYS(D2,F2)-1)/2.4+G2-E2

format as [h]:mm

This will calculate the working hours between your in and out times,
based on a 10 hour day, assuming that in and out times are always
within working hours. It will take weekends into account and can also
be amended to cope with holidays if you want to do that.

If you want to stick with your original method I imagine you could
identify when a weekend has intervened between in date and out date
because this would be the only situation where WEEKDAY(F2) would be
less than WEEKDAY(D2)


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=539083

  #8   Report Post  
Posted to microsoft.public.excel.misc
TLAngelo
 
Posts: n/a
Default WEEKENDS VS. WEEKDAYS

PERFECT! Thanks so much!

"daddylonglegs" wrote:


I think you could use the formula I suggested modified to

=(NETWORKDAYS(D2,F2)-1)/2.4+G2-E2

format as [h]:mm

This will calculate the working hours between your in and out times,
based on a 10 hour day, assuming that in and out times are always
within working hours. It will take weekends into account and can also
be amended to cope with holidays if you want to do that.

If you want to stick with your original method I imagine you could
identify when a weekend has intervened between in date and out date
because this would be the only situation where WEEKDAY(F2) would be
less than WEEKDAY(D2)


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=539083


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
Weekdays only on X axis NNester Charts and Charting in Excel 3 April 25th 05 05:53 PM
Schedule to exclude weekends and holidays Erin D. Excel Discussion (Misc queries) 3 March 15th 05 10:49 PM
Date difference taking into account weekends. annonymous Excel Worksheet Functions 3 March 14th 05 06:35 PM
Recognizing weekends and changing to weekdays in Excel hanauer Excel Discussion (Misc queries) 2 January 8th 05 03:13 AM
Date exclude weekdays LukePW New Users to Excel 9 December 20th 04 06:00 PM


All times are GMT +1. The time now is 08:22 AM.

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"