View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default Count difference in days input box

Not knowing what you have outside A2:B2, I don't what your code is
trying to do after getting the Start Date and Finish Date. Maybe the
following will help. With the Start Date and Finish Date in A2 and B2,
enter the following formulas.
C2: =1+INT(B2-A2)
D2: =NETWORKDAYS(A2,B2)
E2: =IF(MOD(C2-
D2,2)=0,0.5*(C2+D2),IF(WEEKDAY(A2)=1,0.5*(C2+D2)+0 .5,0.5*(C2+D2)-0.5))

These will give the counts of days, weekdays, and days excluding
Saturdays, respectively.

If you want the VBA code for them, turn on the macro recorder. Or
after entering the formulas, you can get the VBA code with the macro
recorder on by selecting each cell, putting your cursor at the end of
the formula, and hitting the Enter key.

Hth,
Merjet