Get The Number Of Workdays Between Two Dates In A VBA Function

Oct 18, 2008

Get the number of workdays between two dates in a VBA function. I tried simply using the Advanced Toolpak function NETWORKDAYS, but I get the error message "Sub or function not defined". I did reference to atpvbaen.xls in the Tools > References menu, so I don't know why Excel is not recognizing the function.

I used the following function to test it:

Function CalcNetDays(dInitial As Date, dEnd As Date)
CalcNetDays = NetworkDays(dInitial, dEnd)
End Function

Any reason the function is not working?
Also, I need to add the holidays to the function. The holidays are listed on a worksheet column. Do I simply add the range to the function, like below?

CalcNetDays = NetworkDays(dInitial, dEnd, Range("Holidays"))

View 9 Replies


ADVERTISEMENT

Calculate Workdays Between Dates

Nov 2, 2006

I am trying to map the total networkdays across the months of the year for a list of contracts with variable start and end dates.

Example of the results I'm after:

Contract StartDate EndDate January February March etc.
Contract1 15 Jan 07 13 Jul 07 13 20 20
Contract2 5 Feb 07 2 Mar 07 0 18 2


I assume that the add-in NETWORKDAYS function is involved (and I'm ordinarily comfortable with using this function with only two dates and my named range of holiday dates), but I can't seem to figure out how to use it in this more complicated way. My own extensive struggles with it have led to ridiculously long and nested formulas that even I didn't understand after a few days away from them. I've searched the posts and seen questions similar to mine, but not close enough to give me a solution.

View 4 Replies View Related

Difference Between 2 Dates In Workdays Only

Mar 4, 2008

I need to calculate the difference between two work days to understand how many days late we missed a due date. The NETWORKDAYS formula gives me the COUNT of the workdays, but I need the difference.

Example 1:
Expected Due date: 3/3/08
Actual Due date: 3/3/08

NETWORKDAYS for the dates above gives me the value of 1, but for my needs I need the resulting value to be zero.

Example 2:
Expected Due date: 3/3/08
Actual Due date: 3/5/08

NETWORKDAYS for example 2 provides a value of -3 (days late), but in reality it's only -2 (days late)

View 7 Replies View Related

VBA Function For Abbreviated Workdays In Cell?

Dec 6, 2013

I need a VBA Function, I have a start dates in column A and end dates in column B what I need in column C is the abbreviated days excluding the weekends. For example if I have 11/11/13 in A1 and 11/20/13 in B1 then in C1 I need (including start and end date) Wed, Thu, Fri, Mon, Tue, Wed, Thu, Fri. Another example If I have 11/29/13 in A1and 12/3/13 in B1 then in C1 I need Fri, Mon, Tue.

View 4 Replies View Related

Workdays Function & Logical IF OR Formula

Aug 8, 2007

what was wrong with this formula, an error message comes up saying VALUE, im trying to get the formula to say that - If 2 dates are different then subtract one from the other to get a number of working days, but if the dates are both the same then to -1 from the value as for some reason the value is coming back as 2 when it should be 0?

=IF(OR(M17>0,N17>0),NETWORKDAYS(M17,N17,holidays)+1+Q17,IF(OR(M17=N17),NETWORKDAYS(M17,N17,holidays)-1,0))

View 9 Replies View Related

Calculate The Number Of Workdays?

Jan 2, 2014

I need a way to calculate the number of workdays, Saturdays and Sundays in a month.

In my model, the client can choose to work on Saturdays and/or Sundays.I need someway to show that a given month (e.g. June 2014) has some # of workdays, and some # of Saturdays and some # of Sundays.I can do this on three separate rows.
eg.

Row 1: Month
Row 2: Wordays
Row 3: Saturdays
Row 4: Sundays

Still i need some way of determining that a given month (June 2014) has 22 work days, 4 Saturdays and 5 Sundays,... et cetera

View 4 Replies View Related

Excel 2007 :: NETWORKDAYS Function - How To Include Saturdays As Workdays

Nov 26, 2011

I have never worked on workdays before so I do not know most of the available formula and play around. I googled across and found this one: [URL] .......

Where Bob has given an ARRAY formula.

Following is my layout in A1 to C3 grid (for testing purpose):
Start Date11/1/2011HOLIDAYEnd Date11/30/201111/3/2011NETWORKDAYS2011/22/2011
The formula resides in B3.

Is there any other development in 2007+ versions of Excel which can handle 6 working days in a week?

View 9 Replies View Related

Subtract Number Of Workdays From A Date

Feb 26, 2014

I am looking for a formula which substract a number of workdays defined in a cell from a date defined i nanother cell. For example I have a date in cell B2: 10.08.2014 - this is the due date for service delivery. In cell C2 there is a number of workdays: 84 - this is the duration for the delivery process. I would like to have a formula calculating in cell D2 the date when the delivery process has to start. The tricky point is that B2 is basicly a range of merged cells B2:B6. As an example I am attaching an exmple sheet.

View 10 Replies View Related

Calculating Number Of Workdays In A Month

Jan 13, 2014

In cell A1 I have a date 1/1/14

I need to get the number of business days for the month that is entered in the cell. I tried NETWORKDAY formula but needs a start and end date.

View 3 Replies View Related

Determine Number Of Workdays Per Week In Given Month

Dec 6, 2013

Is there a formula I can use to determine the number of work days in each week for a given month. The work week would start Sunday, with Friday and Saturday as days off. Each week would be in their own row.

i.e.

January

Week 1: 2 days
Week 2: 5 days
Week 3: 5 days
Week 4: 5 days
Week 5: 3 days

[Code] ..........

View 4 Replies View Related

Calculate The Number Of Days Between Two Dates Using The Days360 Function

Nov 26, 2009

I was calculating the number of days between two dates using the Days360 function. However, now it is not accurate enough for me... Is there a function that is more accurate? based on 365 days and includes leap years... that I could use as I need this calculation to be exact? For example, number of days between April 1st, 2010 and August 31, 2012 is 884, but the days360 function returns 870.

View 4 Replies View Related

Simple Function For Calculating Number Of Months Between 2 Dates

Jun 22, 2012

Is there a simple function for calculating the number of months between 2 dates.

Eg 1/5/2012 - 8/9/2020

View 1 Replies View Related

Function To Fill All Days Of Month To End Of Month Based On Workdays

May 1, 2006

I would like to create a monthly inventory, based on workdays (Monday - Friday)Myrna Larson has a formula that I would like to use with the workday function, but I don't know how to combine them.

=IF(A1="",A1,IF(MONTH(A1+1)=MONTH(A1),A1+1,""))+ = workday

to fit on the page, I need the dates to be from the 1st to the 15th, and 16th to the 31st. I am not sure how to write this either.

View 11 Replies View Related

Pick Range Of Dates And Find Number Of Days Without Sales Between Those Dates

Feb 23, 2014

Here is my set up:

A2 to BF2 is a range of dates

A3 to BF3 are sales. Days without sales are 0.00

I want to pick a range of dates and find the number of days without sales between those dates. So, a formula that will look to a start date in A1 and an end date in B2, and then count the number of days that did not have sales between. Index/Match/Countif/Dateif I can't seem to make anything work.

View 3 Replies View Related

Calculate Number Of Days Between 2 Dates And Then Assign Number Based On Answer

Mar 22, 2014

How to create a spreadsheet with what I think will be a very simple formula?

If date in B2 - date in A2 is 1 or less days, put a 1 in cell C2.
If date in B2 - date in A2 is 7 or less days but more than 1, put a 2 in cell C2.
If date in B2 - date in A2 is 30 or less days but more than 7, put a 3 in cell C2.
If date in B2 - date in A2 is 90 or less days but more than 30, put a 4 in cell C2.
If date in B2 - date in A2 is 91 days or more, put a 5 in cell C2.

OR

Another, maybe simpler, way of saying it is:

If date in B2 - date in A2 is 1 or less days, put a 1 in cell C2.
If date in B2 - date in A2 is 2-7 days, put a 2 in cell C2.
If date in B2 - date in A2 is 8-30 days, put a 3 in cell C2.
If date in B2 - date in A2 is 31-90 days, put a 4 in cell C2.
If date in B2 - date in A2 is 91 days or more, put a 5 in cell C2.

View 9 Replies View Related

VBA To Add Workdays To Datetxtbox

Mar 26, 2014

I have a userform that captures dates and records them to another excel workbook so we can analyse the data. I have one last part to finalise; When a date is added to the "daterecievedtxtbox" I would like a formula to be offset to the end of the spreadsheet, that will take this date and add 3 working days to it. Then I can add in some formulas later to flag them when the date passes the 3 working days.

At the moment I have this:

[Code] ....

Which adds 3 days to this txtbox and writes it to the sheet that I have defined. I would like to know if there is a function that I can use to add 3 WORKING days to this, excluding saturday and sunday.

View 4 Replies View Related

Workdays In A Month

Oct 28, 2009

I would like to know how to get the number of working days in a month based on the date in B4 which is formatted as "mmmm".
So if B4 was October the result would be 22 regardless of the actual date in B4.

I also have a named range "Holidays" for UK bank holidays (ready for December) that I would like included within the formula.

View 9 Replies View Related

Subtracting Workdays From A Set Date

May 13, 2009

I am using excel 2003 and I am trying to subtract 20 days from the date in cell A3 in order to give me a date for me to order materials. However all I get is #NAME? in the cell.

View 4 Replies View Related

Filter For Workdays Returns Nothing

Jul 9, 2014

I am looking to find a way to filter a list for the next twenty business days.

View 7 Replies View Related

Net Workdays Cycle Time?

Dec 3, 2013

So I have a cycle time formula; Start Date to Completion Date, if the task is not complete the completion date field is blank. In this case the cycle time is listed as a negative 5 digit value. The networkdays formula takes into consideration weekends and holidays.How can this field be left blank rather than the negative value?

=NETWORKDAYS(I2,P2,Sheet3!$A$2:$A$10)

View 6 Replies View Related

Add Workdays To Date And Time

Jul 3, 2014

I have data in column C which is the date and time

Data is: 16/06/2014 09:47:14
Cells are formatted as dd/mm/yyyy" "hh:mm:ss

Column H has another date and time based on service level agreements

Data is 17/06/2014 09:47:14
Cells are formatted as dd/mm/yyyy" "hh:mm:ss

I need to add 3 workdays to the 1st value so it returns 19/06/2014 09:47:14

I've used the following formula =WORKDAY(C2,3) and it returns the correct date but time shows as 00:00:00. Is there way I can pick up the time from Cell C2?

View 2 Replies View Related

Display How Many Workdays There Are In A Month

Oct 18, 2007

What formula would I use to display how many workdays there are in a month.

The month is displayed in cell A1

View 9 Replies View Related

Conditional Formatting With Workdays

Sep 7, 2008

I have an excel file I am working on with a due date column. I have already created 2 conditional formatting.

1. if cell value is less than today's date then format the cell red
2. if cell value equals today's date then format the cell orange

I need to create two more conditional format....one where it looks at today's date and if the due date date cell is within 1-3 business days from today's date then I want the cell format to turn yellow and I need a last conditional format to look at today's date again and if the due date cell is within 4 -5 business days from today's date then I want the cell format to turn green. Can these two additional conditional formats be done?

View 9 Replies View Related

How To Use If Function With Dates

Apr 1, 2014

I want to write a function which will calculate whether a certificat needs renewing TODAY or not. The validity of certificate is 12 months.

HTML Code: 

A B C D
type of cert date test done valid or not?
fire 01/01/10
test 01/03/14
health and safety 01/03/14
asbesto 1/03/05
gas 05/05/05
electricity 01/06/13

validity 12 months

View 3 Replies View Related

IF Function With Dates

Jun 13, 2006

The worksheet will have a list of staff and the date they sat for a particular test. I need to be able to highlight in some way when for example 6 weeks has passed so that the staff member can be re-tested.

We want to be able to open this worksheet and see immediately any staff who are overdue for a retest. If they have undertaken such retesting we obviously don't want to see them red flagged or whatever any more.

View 9 Replies View Related

Count Workdays Between 2 Date Cells

Sep 4, 2009

I would require a formula to count the amount of workdays between cell a1 and cell a2. Assume formula is in celll a3 and both a1 and a2 are date formated.

View 2 Replies View Related

Calculate Workdays - Completion Date

Dec 26, 2012

I have the following function:

=IF(G13="",IF(H13>1,1,IF(G13>1,workdays(H13,G13,Holidays))))

The intent is to calculate the completion date against the assigned date as follows:

G13 - Typically the assign date but sometimes can be blank because someone forgets or doesn't bother to insert

For this example, let's say: 12/17/12

H13 - Completion date

For this example, let's say: 12/20/12

I'm expecting a result of '3' for 3 days

The first half of the function is intended to calculate 1 day if G13 is blank or not defined. However, when I have dates in both cells, I'm getting a "false" answer instead of a numerical value that I'm expecting.

In our workplace, we do work weekends & sometimes 7 days a week.

View 11 Replies View Related

User Defined Workdays UDF Required

May 7, 2008

I need to create a business days calendar consisnting of two columns start_date and end_date. Start_date is today (always a work day), end_date column will have to be start_day +1 day, start_day +2 days, start_day +7 days, start_day +30 days, and so on till + 3600 days. Every end_date must fall on a business day, or the first following business day if it is falls on a WE. Assume I know all holidays for the next 10 years. I could use Workdays or other built in function, the trouble is they all assume Sat and Sun as WE, my WEs are FRI and SAT! I tried to write a UDF but I'm failing miserably with too many ifs and elses,

View 9 Replies View Related

Generate Workdays For 1996 And Forward

Jul 11, 2009

i am trying to determine how to use the workday function to generate only workdays for 1996 and forward. Each year is listed in a separate column.

View 9 Replies View Related

Add X Workdays To Date Including Saturdays

Apr 30, 2008

How to add 2 "working days" to a date, including Saturdays as work days, and excluding holidays and Sundays? Similar to: = WORKDAY ("01/02/2008", 2, 39451) But instead of resulting in Mon Jan 7th, the answer should be Sat Jan 5th. (39451 is Fri Jan 4th.)

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved