How to Count Cells between Two Dates or Times in Excel

This post will guide you how to count cells between two dates using a formula in Excel 2013/2016. How do I count times between a given time or date range based on a condition in Excel. Is there a easy way to count cells between two given dates in a selected range of cells in Excel.

Count Cells between Dates


Assume that you have a list of data in range A1:B6, and you want to count cells which between 2020/1/1 and 2020/12/31. In the below steps, and you should learn that how can we use COUNTIF function to achieve the result of counting times between two given dates in Excel.

You can use the following formula based on the COUNTIF function:

=COUNTIFS(B2:B6,”>=”&DATE(2020,1,1),B2:B6,”<=”&DATE(2020,12,31))

count cells between dates formula1

Let’s see how this formula works:

The COUNTIFS function can be used to count cells that meet one or more criteria in the given range cells.

From the above screenshot, and you can see that this formula will count sales date in the year 2020, that appear in the range B2:B6. To count cells between two dates, and you need to provide two criteria in COUNTIFS formula. One is for start date and one is for the end date. And the range of cells that you want to compare is B2:B6.

And you still need to construct both starting date and ending date for comparing in the above COUNTIFS formula. You can use the DATE function to do it. Like below:

=DATE(2020,1,1)

=DATE(2020,12,31)

count cells between dates formula2

You also need to concatenate “greater than or equal to” or “smaller than or equal to” operators with concatenate operator to build those two conditions.

=”>=”&DATE(2020,1,1)

=”<=”&DATE(2020,12,31)

count cells between dates formula3

Then you can combine these formulas into one like as below:

= B2:B6,”>=”&DATE(2020,1,1),B2:B6,”<=”&DATE(2020,12,31)

This formula can be added into the COUNTIFS formula as its criteria. It performs AND logic because it must be satisfied for both two conditions.

Related Functions


  • Excel COUNTIFS function
    The Excel COUNTIFS function returns the count of cells in a range that meet one or more criteria. The syntax of the COUNTIFS function is as below:= COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)…
  • Excel DATE function
    The Excel DATE function returns the serial number for a date.The syntax of the DATE function is as below:= DATE (year, month, day)…

 

 

 

 

 

 

Related Posts

Break ties with helper COUNTIF and column

Suppose you got a task to adjust the values that contain the ties; what would be your first attempt to break the ties of the given value? If you are wondering about doing this task manually, let me add that ...

Calculate Total Cost with Excel VLOOKUP Function

In today's article we will show you how to calculate the total cost for a given weight using the Excel VLOOKUP function. This function will help us to find the appropriate unit price for that weight and then we can ...

Excel Formulas To Calculate The Bond Valuation

Assume that you've been assigned a task of calculating bond valuation; so if you are new to Ms Excel or do not have much experience with it, then I am pretty sure about it that doing this task manually might ...

Calculate Cumulative Totals with Excel SUM Function

Today, through a simple example, we will show you how to use one of the most common-used Mathematical functions in excel, the SUM function, to add up the sum. In our daily life, we keep an account of what we ...

BMI Calculation Formula In Ms Excel

You might have come across a task in which you were assigned to make BMI calculations of the supplied numbers, and you may be looking for an efficient approach to accomplish this process rather than doing BMI calculations manually, by ...

Calculate The Period of Loan or Investment in Excel

In our daily life, most of us will invest or take a loan, so we need to master some simple financial functions to calculate the period needed for loans or investments. If you work as an accountant, you need to ...

Working Time Calculation Based on Timesheets

In the office, a special machine record the time when you start working (clock in office) and when you finish working (clock out of office). We can calculate the total working time by subtracting the end working time from the ...

Sort/Rank Numeric Values with Duplicate Values Exist

Excel built-in RANK function can sort a set of values. If there are duplicate numbers, then the rank number is also duplicated. See the following example: There are two numbers “100” in range A2:A9, they are both the third largest ...

Calculate Days Open in Excel

If you want to know how to Calculate days in Excel, there are some formulas that you can use to do so. For example, you can use the DAYS function in Excel to find the number of days between two ...

Calculate Grades With VLookup in Excel

Why Should You Calculate Grades With VLookup Excel? If you're looking for a simple way to find out a student's grades, VLOOKUP Excel can do the trick. This function uses a lookup table to find the values and sort them ...

Sidebar