Go Back

Count holidays between two dates

We often need to count holidays between two dates while developing a timeline for a project. In Excel, we can achieve this by using the COUNTIFS or the SUMPRODUCT function when we have a list of holidays’ dates in a range. This article will explain the process.

Figure 1. Counting Holidays Between Two Dates

Counting Holidays Using the COUNTIFS Function

When holidays’ dates are listed in a range then we can count holidays between two dates using the COUNTIFS function. The COUNTIFS function will count the cells in range C2: C11, where dates fall between the start date and end date criteria, given in cells F2 and F3 as per our example in the following formula in cell F5;

=COUNTIFS(C2:C11,">="&F3,C2:C11,"<="&F4)

Figure 2. Counting Holidays Using the COUNTIFS Function

Counting Holidays Using the SUMPRODUCT Function

Using the SUMPRODUCT function we can count the cells in range C2: C11 that meet the two expressions, greater than equal to start date (>=start_date) and less than equal to the end date (<=end_date). The following formula will be used in cell F5 to count the holidays between two dates;

=SUMPRODUCT((C2:C11>=F3)*(C2:C11<=F4))

Figure 3. Counting Holidays Between Dates Using the SUMPRODUCT Function

When we test each expression on a single array it generates an array of TRUE and FALSE logical values, such as;

Expression (C2: C11>=F3) returns an array of logical values as follows;

{FALSE;FALSE;FALSE;FALSE;FALSE;TRUE;TRUE;TRUE;TRUE;TRUE}

And expression (C2: C11<=F4) returns an array of logical values as follows;

{TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE}

As per boolean logic, when these arrays of TRUE and FALSE are multiplied they generate an array of 1s and 0s and the SUMPRODUCT sums the values inside it. To see the working of this formula in Excel formula bar, select both expressions inside the SUMPRODUCT function and press F9, such as;

=SUMPRODUCT({0;0;0;0;0;1;1;1;1;1})

Figure 4. Working of the SUMPRODUCT Function to Count Holidays

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

Need help creating a formula to count between two dates.
Solved by F. H. in 25 mins
how to count UNIQUE no. of days between two dates without overlapping
Solved by S. S. in 24 mins
Hi, What is the formula in excel to calculate the number of days between two cells, with dates in them, excluding weekdays and holidays, if the number is greater than zero, or return zero if it is not (if the two dates are the same)? Thanks, Rose
Solved by D. Q. in 22 mins

Leave a Comment

avatar