Excel Function to Calc Elapsed Hours (Excluding Weekends)

I have a need to calculate the hours between two time and date columns (e.g. 2/24/2015  12:39:00 PM and 2/24/2015  2:31:00 PM)

Some cover time over multiple dates. I would like to exclude weekends from that elapsed time.

Can anyone help me with this? Thank you
RexQuality LeaderAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexei KuznetsovMicrosoft Outlook MVPCommented:
=NETWORKDAYS(A1,A2)

You can also include local/federal holidays as a third parameter. Please find more on Excel Help: https://support.office.com/en-au/article/NETWORKDAYS-function-5fb5a1fa-c42d-4162-a762-7b1fc97215c5
0
Saurabh Singh TeotiaCommented:
Assuming you have start date in A1 and end date in B1..Then you can use this formula...

=(B1-A1)-(NETWORKDAYS(A1,B1)*TIME(24,,))

Saurabh...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob HensonFinance AnalystCommented:
The NETWORKDAYS function gives you the number of working days between two dates. You could then use the time parts of the two values to work out the additional hours.

Thanks
Rob H
0
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Alexei KuznetsovMicrosoft Outlook MVPCommented:
0
Rob HensonFinance AnalystCommented:
Assuming date and time in C5 and E5:

=NETWORKDAYS(C5,E5)-1+(MOD(E5,1)-MOD(C5,1))

As example:
20 Feb 2015 12:39
23 Feb 2015 04:31

Above formula gives 15:52 (15 hours 52 minutes)

21 & 22 Feb were weekend so should be ignored.
20th 12:39 to midnight is 11:21.
Midnight 22nd to 23rd 4:31 is 4:31
11:21 + 4:31 = 15:52

Use custom format of [h]:mm to show total number of hours without rounding to days; ie 35 hours in normal time formatting would show as 11:00 but using that custom format would show 35:00

Is this what you are after or are there working times/shifts that need to be considered?

Thanks
Rob H
0
ProfessorJimJamMicrosoft Excel ExpertCommented:
please find attached.
EE.xlsx
0
Rob HensonFinance AnalystCommented:
@ProfJimJam - your sample with two dates:

1 Jan 15 16:51
2 Jan 15 11:23

Your result 5:32

What does the 18/24 - 7/24 section do? I assume this gives working shift of 07:00 to 18:00. Where did you get that requirement? I asked the question but don't see an answer. Without that shift requirement, the result would be 18:32 ie 13 hours more being the spell between 18:00 on 1 Jan and 07:00 on 2 Jan.

Thanks
Rob H
0
barry houdiniCommented:
Saurabh,

TIME(24,,) = 0

!

Rob's formula should work assuming you are counting all 24 hours in the day (except Saturday and Sunday) and as long as your start/end dates aren't on Saturday or Sunday. Will that be the case?

regards, barry
0
Saurabh Singh TeotiaCommented:
Ahhh Barry my bad..didn't catch that on first place..Thanks for correcting..
0
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.