# Count cells that are dates and in a particular year

You can display the number of cells that contain a date in a particular year by using the COUNTIFS function.
This function uses two criteria to satisfy two conditions.

### Example

Lets assume the years have been entered into a column.
The first step is to create a date which is the first day of that year.
The second step is to create a date which is the last day of that year.

 A B 1 =DATE(B1, 1, 1) = 01 Jan 2020 2020 2 =DATE(B1, 12, 31) = 31 Dec 2020 3 =DATE(B3, 1, 1) = 01 Jan 2021 2021 4 =DATE(B3, 12, 31) = 31 Dec 2021 5 =DATE(B5, 1, 1) = 01 Jan 2022 2022 6 =DATE(B5, 12, 31) = 31 Dec 2022

Once we have the start and end dates we can use these dates to create our criteria.
The first criteria is any date greater than or equal to the start date.
The second criteria is any date less than or equal to the end date.

 A B C D 1 =COUNTIFS(D1:D8, ">="&B1, D1:D8, "<="&B2) = 2 01 Jan 2020 2020 01 Jul 2020 2 =COUNTIFS(D1:D8, ">="&B3, D1:D8, "<="&B4) = 4 31 Dec 2020 24 Oct 2021 3 =COUNTIFS(D1:D8, ">="&B5, D1:D8, "<="&B6) = 2 01 Jan 2021 2021 03 Mar 2021 4 31 Dec 2021 02 Dec 2022 5 01 Jan 2022 2022 11 Dec 2020 6 31 Dec 2022 24 Feb 2021 7 25 Feb 2022 8 16 Apr 2021

### Alternative Formulas

The COUNTIFS function was added in Excel 2007.
Before Excel 2007 there were two ways to perform conditional counting.
One was using the SUMPRODUCT function and the other was using Array Formulas.
If you are using the SUMPRODUCT function you will also need to use the double minus operator to convert boolean values into there corresponding ones and zeros.

### Built-in Functions

COUNTIFS - The number of numerical values in a list, table or cell range that satisfies multiple conditions.
DATE - The date as a date serial number given a year, month, day.