How about this logic:
You can calculate the number of Networkdays.
This INCLUDES the entire day.
Your core hours are 6:00am to 7:00pm, or 13 hours, so

NETWORKDAYS(A2,B2)*13

gives you the number of h ours in full days of work.

Next, determine if the starting and ending days are non-working days.
If they are, no adjustments are required.
If they're working days, then you have to determine if the start/end time is 
before 6:00am or after 7:00pm.

At the beginning of the date range, 

if(WEEKDAY(A2,16)<3  
will determine if the starting day is a Saturday or Sunday.
If it is not, then IF(MOD(A2,1) > 0.25  will determine if the starting time is 
after 6:00am.

at the end, IF(WEEKDAY(B2,2)>5 will determine if the ending date is Saturday or 
Sunday.
If it is NOT, then IF(MOD(B2,1) > 19/24 will determine if the time is after 
7:00pm.

so, this formula seems to work:

=NETWORKDAYS(A2,B2)*13
+IF(WEEKDAY(A2,16)<3,0,IF(MOD(A2,1) > 0.25,0.25-MOD(A2,1),0))
+IF(WEEKDAY(B2,2)>5,0,IF(MOD(B2,1) > 19/24,0,-(19/24-MOD(B2,1))))

Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: LJ <ljasonmil...@gmail.com>
To: excel-macros@googlegroups.com
Sent: Wed, August 29, 2012 8:32:18 AM
Subject: $$Excel-Macros$$ Re: NETWORKDAYS Formula to calculate amount of hours

Hi Paul, 

My apologies and thanks for the lesson in etiquette. I was trying to be brief 
as 
to not bog people down with unnecessary details. I have a formula that I have 
been using, as stated, in a previous thread. However, it doesn't work when 
calculating non-core hours. Simply put, it doesn't matter if I have to use 1 
formula to get the total time or a combination of formulas.

I have attached an example .xlsx



On Wednesday, August 29, 2012 6:56:47 AM UTC-4, LJ wrote: 
I need a NETWORKDAYS formula to calculate the time between a start and end date 
and time during the work hours of 6AM and 7PM and excluding weekends. The 
format 
for the results need to be in hh:mm:ss format.
>
>
>A2 = End Time
>B2 = Start Time
>
>
>Appreciate the help.
>
>
>LJ-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES (1120+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

 
6) Jobs posting is not allowed.
 
7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners 
and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.

-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES (1120+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

6) Jobs posting is not allowed.

7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.


Reply via email to