Solved

vba to exclude Saturday and Sunday from date calculation

Posted on 2012-03-28
2
353 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

749 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