ThisCalculator

Everyday

Count Cells Between Dates in Excel (Easy Steps)

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Count Cells Between Dates in Excel (Easy Steps)

To count cells between two dates in Excel, use the COUNTIFS function with two criteria: one for the start date and one for the end date. For example, =COUNTIFS(A:A,">="&D1, A:A,"<="&E1) counts dates in column A that fall on or between the dates in D1 and E1. This article explains the formula, how to handle common pitfalls like date formatting and blank cells, and provides alternatives for more complex scenarios.

Formula

The core formula is COUNTIFS(date_range, ">="&start_date, date_range, "<="&end_date). In words: count the number of cells in date_range that are greater than or equal to the start date AND less than or equal to the end date. The & concatenates the comparison operator with the cell reference containing the date. The COUNTIFS function evaluates each cell against both criteria and returns the count of cells that satisfy both.

  • date_range: the range of cells containing dates (e.g., A2:A100).
  • start_date: a cell reference or date value that defines the lower bound (inclusive).
  • end_date: a cell reference or date value that defines the upper bound (inclusive).

Worked Example

Suppose you have dates in cells A2:A6: 2024-03-15, 2024-07-22, 2024-11-02, 2024-01-10, and 2024-12-25. You want to count how many fall between 2024-01-01 and 2024-12-31. The formula =COUNTIFS(A2:A6,">="&DATE(2024,1,1), A2:A6,"<="&DATE(2024,12,31)) returns 5, because all five dates are within that range. If you change the end date to 2024-11-30, the count becomes 4, excluding the December date.

When to Use This Formula

This formula is ideal for analyzing date-based data such as sales records, project timelines, or event logs. It helps answer questions like "How many orders were placed in March?" or "How many employees joined between two specific dates?" The COUNTIFS function is flexible and can be combined with other criteria, like counting only sales above a certain amount within a date range.

Common Mistakes and Pitfalls

  • Dates stored as text: If your dates are text strings, COUNTIFS won't recognize them as dates. Convert text to dates using the DATEVALUE function or Excel's Text to Columns feature.
  • Incorrect date format: Ensure your system's date format matches the format in your cells. For example, if your system uses MM/DD/YYYY, a date like 2024-01-01 might be misinterpreted.
  • Using COUNTIF instead of COUNTIFS: COUNTIF only handles one criteria. For a range, you need COUNTIFS.
  • Off-by-one errors: The formula includes both start and end dates. If you want to exclude the start date, use ">" instead of ">=".
  • Blank cells or errors: COUNTIFS ignores blank cells, but if a cell contains an error, it will be counted. Use IFERROR to handle these cases.

Alternatives and Advanced Tips

If you need to count dates based on a dynamic range, consider using a pivot table or the SUMPRODUCT function. For example, =SUMPRODUCT((A2:A100>=D1)*(A2:A100<=E1)) works similarly but allows array operations. For counting unique dates between two dates, use =SUMPRODUCT((A2:A100>=D1)*(A2:A100<=E1)/COUNTIF(A2:A100,A2:A100)).

When working with large datasets, COUNTIFS is efficient and fast. It also works with named ranges, making formulas easier to read. For example, define a named range "Dates" for A2:A100 and use =COUNTIFS(Dates,">="&D1, Dates,"<="&E1).

Frequently Asked Questions

Can I count cells between two dates with multiple criteria?

Yes, COUNTIFS can handle multiple criteria. For instance, to count sales between two dates for a specific product, add another pair: =COUNTIFS(DateRange,">="&D1, DateRange,"<="&E1, ProductRange,"Widget").

How do I count dates in a specific month?

Use the first day of the month as the start date and the last day as the end date. For example, for March 2024: =COUNTIFS(DateRange,">="&DATE(2024,3,1), DateRange,"<="&DATE(2024,3,31)).

Why is my COUNTIFS returning 0?

Check that your date cells are actually dates (not text), that the start date is before the end date, and that the comparison operators are correctly concatenated. Also, ensure the date range includes the cells you expect.

Can I count dates that are today or earlier?

Yes, use the TODAY() function: =COUNTIFS(DateRange,"<="&TODAY()). This counts all dates up to and including today.

Does COUNTIFS work with time and date combined?

Yes, but be careful. A date cell with a time component (e.g., 2024-01-01 14:30) is considered greater than the same date at midnight. To count all times on a specific date, use ">="&DATE(2024,1,1) and "<"&DATE(2024,1,2).

Related

Formula used
in start | Start date | - | 2024-01-01 | 0
in end | End date | - | 2024-12-31 | 0
in dates | Date list | - | 2024-03-15, 2024-07-22, 2024-11-02 | 0
out count | Count between dates | - | count(filter(dates, and(dates >= start, dates

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.