# Weekend Time

#### BCS2

##### Board Regular
I am calculating the difference between a start and a stop time but don't want to include the weekends.

Is there a function to do this?

### Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
try using NETWORKDAYS fucntion

Hi ,
try this one
Book1
ABCDEF
1
201.01.200422
331.01.2004
4
5
Sheet1

I need to get more specific than just days. I need to be able to determine how many hours and minutes that elapsed between the start and finish times.

By the way, I am having trouble with Colo's HTMLMaker. I had it working yesterday but today it gives me a compile error "'Can't find project or library". I checked the VBA Editor for a "missing" line but there wasn't one in the list. Any ideas?

which version of html maker do you have? i couldn't get ver 2.41 to work for me, but 1.00 works like a charm. that would really help i think. sounds like a couple of ways to do what you want.

i use:

=IF(INT(StartDT)=INT(EndDT),ROUND(24*(EndDT-StartDT),2),(24*(DayEnd-DayStart)*(MAX(NETWORKDAYS(StartDT+1,EndDT-1,HolidayList),0)+INT(24*(((EndDT-INT(EndDT))-(StartDT-INT(StartDT)))+(DayEnd-DayStart))/(24*(DayEnd-DayStart))))+MOD(ROUND(((24*(EndDT-INT(EndDT)))-24*DayStart)+(24*DayEnd-(24*(StartDT-INT(StartDT)))),2),ROUND((24*(DayEnd-DayStart)),2))))

(which i'm sure can be made simpler!! )

Named Ranges are:
StartDT = Start Time (i.e. 11/05/2003 2:52:12 PM)
EndDT = End Time (i.e. 11/06/2003 1:34:16 PM)
DayStart = Start Time of work (i.e 7 am)
DayEnd = End Time of work (i.e. 5 pm)
HoildayList = Range of cells that are holiday (i.e. Dec 25th, etc), this isn't needed if there are none.

Hope you can figure it out!

i believe there is a shorter formula.

i came up with:

=(NETWORKDAYS(A1,B1))+((B1-A1)-(NETWORKDAYS(A1,B1))-INT((B1-A1)-(NETWORKDAYS(A1,B1))))

where a1 houses start date and time(must be formatted to date&time), b1 houses end date and time(must be formatted to date&time).

cell w/ formula must be formatted to number w/ 3-4 decimals (for accuracy)

looks like:

hope this helps.

firefytr, that gets me close, but it I need the reult to be expresses in HH:MM. I have formatted cell C1 to [H]:mm, but the result is incorrect. What am I doing wrong?
Estimate Tracking Example.xls
ABCD
11/6/049:42AM1/6/0410:49AM25:07
Sheet1

no your not doing anything wrong. the formula simply displayed it as days w/ 2 decimals. with what you want, it gets more comlicated. since dates can span more than a day, i did it like this:

change formula to (and i know, it's much longer ):

=(NETWORKDAYS(A1,B1))&" Days "&INT(((((NETWORKDAYS(A1,B1))+((B1-A1)-(NETWORKDAYS(A1,B1))-INT((B1-A1)-(NETWORKDAYS(A1,B1)))))-INT((NETWORKDAYS(A1,B1))+((B1-A1)-(NETWORKDAYS(A1,B1))-INT((B1-A1)-(NETWORKDAYS(A1,B1))))))*1440)/60)&" Hours "&ROUND((((((NETWORKDAYS(A1,B1))+((B1-A1)-(NETWORKDAYS(A1,B1))-INT((B1-A1)-(NETWORKDAYS(A1,B1)))))-INT((NETWORKDAYS(A1,B1))+((B1-A1)-(NETWORKDAYS(A1,B1))-INT((B1-A1)-(NETWORKDAYS(A1,B1))))))*1440)/60-INT((((NETWORKDAYS(A1,B1))+((B1-A1)-(NETWORKDAYS(A1,B1))-INT((B1-A1)-(NETWORKDAYS(A1,B1)))))-INT((NETWORKDAYS(A1,B1))+((B1-A1)-(NETWORKDAYS(A1,B1))-INT((B1-A1)-(NETWORKDAYS(A1,B1))))))*1440)/60),2)&" Minutes"

w/ "=date(2004,1,1)" in a1, and "=today()+0.167" in b1 (+0.167 for 4 hours - to test with), this is what you should see.
16 Days 4 Hours 0.01 Minutes

you can modify this in any way.

this formula should just give you hours w/ 3 decimal points.

=((INT((NETWORKDAYS(A5,B5))+((B5-A5)-(NETWORKDAYS(A5,B5))-INT((B5-A5)-(NETWORKDAYS(A5,B5))))))*24)+((NETWORKDAYS(A5,B5))+((B5-A5)-(NETWORKDAYS(A5,B5))-INT((B5-A5)-(NETWORKDAYS(A5,B5)))))-INT((NETWORKDAYS(A5,B5))+((B5-A5)-(NETWORKDAYS(A5,B5))-INT((B5-A5)-(NETWORKDAYS(A5,B5)))))

hope this helps you. sorry about the long wait.

edit: second formula i inserted four rows so all references are 5th row instead of 1st! - i'm sorry for the confustion

Replies
4
Views
79
Replies
1
Views
173
Replies
4
Views
46
Replies
2
Views
522
Replies
12
Views
196

1,211,434
Messages
6,101,831
Members
447,758
Latest member

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back