Count cells that are dates between 2 dates

You can count how many cells contain values in a particular range using the COUNTIFS function.
This formula can return the number of cells between two dates.


Example

How many dates are there between 2 May and 5 May (inclusive).
Lets assume the dates have been entered into a column.
The first step is to create a date that is the first date in the range.
The second step is to create a date that is the last last in the range.
If you have a string date you can pass this to the DATEVALUE function.
If you have year/month/day components you can pass these to the DATE function.

 AB
1=DATEVALUE("02 May 22") = 02 May 202201 May 2022
2=DATE(2022, 5, 5) = 05 May 202202 May 2022
3 03 May 2022
4 04 May 2022
5 05 May 2022
6 06 May 2022

Once we have the start and end date 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.

 ABC
1=COUNTIFS(C1:C6, ">="&B1, C1:C6, "<="&B2) = 402 May 202201 May 2022
2 05 May 202202 May 2022
3  03 May 2022
4  04 May 2022
5  05 May 2022
6  06 May 2022

Built-in Functions

COUNTIFS - The number of numerical values that satisfies multiple conditions.
DATE - The date as a date serial number given a year, month, day.
DATEVALUE - The date serial number given a date in text format.


User Defined Function

COUNTBETWEEN - Returns the number of cells that have a value that is between a range.


Related Formulas

Count cells that are dates and in a particular year
Count cells that are numbers in a range


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top