Calculating weekdays

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I am using Excel 97 and want to calculate weekdays between
two cell values. I have found the following function and
cell function from Microsoft but want it to look up cell
references instead of dates can anyone assist please?


Here's the function:

Function DateSpan(BegDate As Date, EndDate As Date) As
Variant
Dim DateArray() As Variant, i As Integer, Span As
Integer
BegDate = DateValue(BegDate)
EndDate = DateValue(EndDate)
Span = EndDate - BegDate + 1
ReDim DateArray(1 To Span)
For i = 1 To Span
DateArray(i) = BegDate + i - 1
Next
DateSpan = DateArray

End Function


Here's the cell code:


=NETWORKDAYS(DATEVALUE("12/1/98"), DATEVALUE("1/1/99"),
DateSpan("12/24/98","1/1/99"))


I want to change the dates listed to a cell reference.


Thanks in anticipation



Mark
 
I am using Excel 97 and want to calculate weekdays between
two cell values. I have found the following function and
cell function from Microsoft but want it to look up cell
references instead of dates can anyone assist please?


Here's the function:

Function DateSpan(BegDate As Date, EndDate As Date) As
Variant
Dim DateArray() As Variant, i As Integer, Span As
Integer
BegDate = DateValue(BegDate)
EndDate = DateValue(EndDate)
Span = EndDate - BegDate + 1
ReDim DateArray(1 To Span)
For i = 1 To Span
DateArray(i) = BegDate + i - 1
Next
DateSpan = DateArray

End Function


Here's the cell code:


=NETWORKDAYS(DATEVALUE("12/1/98"), DATEVALUE("1/1/99"),
DateSpan("12/24/98","1/1/99"))



I want to change the dates listed to a cell reference.


Thanks in anticipation



If what you want is the number of weekdays between BegDate and EndDate, you
could just use NETWORKDAYS alone:


=NETWORKDAYS(start_date,end_date,holidays)

start_date and end_date can be cell references.

Holidays is optional. If you use it, it can be a cell range.

Note that NETWORKDAYS does an inclusive count. So depending on the results you
desire, you may need to subtract one (1) from the answer.






--ron
 
Back
Top