Solved

vba to exclude Saturday and Sunday from date calculation

Posted on 2012-03-28
2
360 Views
Last Modified: 2012-06-21
I have a spreadsheet where I need to calculate the number of minutes between to time fields and to include weekdays in the calculation IF the oldest time in the queue is a day prior to the current day.   How would I do this? the formula is in ( i12).  columns g & H are hidden I have  attached a sample of the spreadsheet

Thank You
2012-Research-Queue-Checkpoint.xls
0
Comment
Question by:eyes59
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 37779679
The NETWORKDAYS function returns the number of weekdays between two dates. If both dates are the same, it returns 1. So neglecting any correction for starting time, you might use:
=IF(H12="","",(NETWORKDAYS(B12,E12)-1+H12-C12)*1440)

The above formula is probably not sophisticated enough for your real problem. Among other things, it can't return a negative number. And it ignores your special handling for Mondays. But if you can give some sample data and expected results, I can fine-tune the formula to suit.

As an added bonus, NETWORKDAYS can exclude a list of holidays that you choose from the calculation. That feature may or may not come into play for your real situation--but for many problems it does.
0
 
LVL 81

Expert Comment

by:byundt
ID: 37781490
eyes59,
Please continue to post in this thread if you need help with implementation. Doing so adds value to the question in the Experts Exchange database.

Brad
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question