View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Days between 2 dates excluding Sundays only

On Thu, 29 Sep 2011 16:15:07 -0700 (PDT), JGGL wrote:

Hi, I need to get the number of days between 2 dates excluding Sundays
only. I know about networkdays but that exclude all weekend and take
in consideration all week days as 1 day.
Example 1
A2 = Sep 16 (Fri)
B2 = Sep 19 (Mon)
If you do B2-A2 = 3 because Fri = 0 Sat = 1 Sun = 1 and Mon = 1
Using NETWORKDAYS(A2,B2) = 2 because Friday = 1 and Monday = 1
What I need is B2-A2 = 2 Fri = 0 Sat = 0 Sun = 1 and Mon = 1
Result 2

Example 2
A2 = Sep 15 (Thu)
B2 = Sep 16 (Fri)
If you do B2-A2 = 1 because Thu = 0 Fri = 1
Using NETWORKDAYS(A2,B2) = 2 because Thu = 1 and Fri = 1
What I need is B2-A2 = 1 Thu = 0 Fri = 1

Are you able to help me?



=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A2&":"&B2)))<1))-1