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

and less than equal to the end date **(>=start_date)**

. The following formula will be used in cell F5 to count the holidays between two dates;**(<=end_date)**

**=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

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

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

And expression

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

`{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.

## Leave a Comment