ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Days between 2 dates excluding Sundays only (https://www.excelbanter.com/excel-programming/445002-days-between-2-dates-excluding-sundays-only.html)

JGGL

Days between 2 dates excluding Sundays only
 
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?


Ron Rosenfeld[_2_]

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



All times are GMT +1. The time now is 11:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com