datetimeexcel-formulaexcel-2010

How to get the days in a date range that belong to a certain month using Excel?


I have an excel sheet that basically looks like this:

A (START) B (END)
1 23.12.2013 03.01.2014
2 20.01.2014 25.01.2014

and so forth. The dates stored in start and end could be in the same month but are not necessarily. Simply summing up workdays in a range is not that hard: =NETWORKDAYS(A1;B1) is fine here.

So the question is how do I sum up the work days in a range that belong to a certain month? For the first row for example the result would be 7 for December and 3 for January.


Solution

  • For example, if your bounds are in cells A1 and A2 and you want to intersect the range with December 2013:

    =NETWORKDAYS(MAX(A1,DATE(2013,12,1)),MIN(A2,DATE(2013,12,31)))