ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Conditional math
  3. COUNTIF With Dates: Before, After and Between

COUNTIF With Dates: Before, After and Between

By ExcelReady Team·Updated November 1, 2026·6 min read

The short answer

To count dates in Excel, join an operator to a date built with DATE: =COUNTIF(B2:B8,">="&DATE(2024,3,1)) counts dates on or after 1 March 2024. Use "<" for before. To count between two dates, use COUNTIFS with two conditions: =COUNTIFS(B2:B8,">="&DATE(2024,3,1),B2:B8,"<="&DATE(2024,3,31)). Build dates with DATE rather than typing them as text, which depends on regional settings.

Key takeaways

  • Build criteria dates with DATE(year,month,day) and join the operator with &: ">="&DATE(2024,3,1).
  • Typing a date as text inside the criteria depends on regional settings, so avoid it.
  • Count between two dates, or within a month, with COUNTIFS and two conditions on the same column.
  • With a date in a cell, use ">="&E1, never ">=E1".
  • If the dates include times, count up to the next day with "<" instead of "<=" the last day.
On this page+
  1. How dates work in COUNTIF criteria
  2. How to count dates before or after a date
  3. How to count dates between two dates
  4. How to count dates in a month
  5. How to use dates from cells
  6. How to count dates relative to today
  7. Why COUNTIF with dates returns 0 or the wrong count
  8. How to count dates with a second condition
  9. Practise it

A COUNTIF date formula in Excel counts the dates before, after or between the days you choose. The key is to build the date with DATE and join it to the operator with &, as in =COUNTIF(B2:B8,">="&DATE(2024,3,1)). This guide shows each kind of date count on one small ticket log, plus whole months, dates in cells, today's date and the reasons a date count returns 0.

How dates work in COUNTIF criteria#

Excel stores every date as a number: the count of days since 1 January 1900. 1 March 2024 is the number 45352, shown in a date format. So counting dates is really counting numbers, and the same operators work: >, <, >=, <= and <>.

The safest way to write a date in a criteria is the DATE function, DATE(year, month, day), joined to the operator with &:

Excel formula
">="&DATE(2024,3,1)

You may see criteria like ">=3/1/2024". Excel tries to read that text as a date using your computer's regional settings, so 3/1 is 1 March in the US but 3 January in the UK. DATE always means the same day everywhere.

Every example uses this ticket log in A1:B8:

AB
1TicketOpened
2T-20126 Feb 2024
3T-2021 Mar 2024
4T-2038 Mar 2024
5T-20415 Mar 2024
6T-20529 Mar 2024
7T-2062 Apr 2024
8T-20715 Apr 2024

How to count dates before or after a date#

Use COUNTIF with one condition. These are the common forms:

QuestionFormulaResult
On or after 1 Mar 2024=COUNTIF(B2:B8,">="&DATE(2024,3,1))6
Before 1 Mar 2024=COUNTIF(B2:B8,"<"&DATE(2024,3,1))1
After 15 Mar 2024=COUNTIF(B2:B8,">"&DATE(2024,3,15))3
On or before 15 Mar 2024=COUNTIF(B2:B8,"<="&DATE(2024,3,15))4
Exactly 15 Mar 2024=COUNTIF(B2:B8,DATE(2024,3,15))1

Watch the difference between > and >=. "After 15 March" with > leaves out T-204, which was opened on 15 March. "On or before 15 March" with <= keeps it. Together they cover all seven tickets: 3 + 4 = 7. If COUNTIF itself is new, start with how to use COUNTIF.

How to count dates between two dates#

COUNTIF takes one condition, so for a date range use COUNTIFS with the same column twice: one condition for the start and one for the end.

Excel formula
=COUNTIFS(B2:B8,">="&DATE(2024,3,1),B2:B8,"<="&DATE(2024,3,31))

The result is 4: T-202, T-203, T-204 and T-205. A date is counted only when it passes both tests. The COUNTIFS function guide lists the arguments, and COUNTIF vs COUNTIFS explains the difference between the two functions. The same between pattern works for any numbers, as shown in COUNTIF between two numbers.

How to count dates in a month#

To count a whole month, count from its first day to its last. EOMONTH finds the last day for you, so you don't need to remember whether a month has 30 or 31 days. With 1 Mar 2024 in E1:

Excel formula
=COUNTIFS(B2:B8,">="&E1,B2:B8,"<="&EOMONTH(E1,0))

EOMONTH(E1,0) returns 31 March 2024, the end of the month that E1 is in. The result is 4. Change E1 to 1 Apr 2024 and the count becomes 2 (T-206 and T-207).

To build a monthly summary, list the first day of each month down column E, put this formula next to the first one with the range locked as $B$2:$B$8, and fill down (Windows: Ctrl+D; Mac: ⌘D). To total amounts by month instead of counting rows, see how to sum by date range or month.

How to use dates from cells#

Put the start and end dates in cells so anyone can change the period. With the start date in E1 and the end date in F1:

Excel formula
=COUNTIFS(B2:B8,">="&E1,B2:B8,"<="&F1)

The operator stays inside quotes and the cell reference stays outside, joined with &. Writing ">=E1" is the most common mistake: inside quotes, E1 is just text, so the formula returns 0.

How to count dates relative to today#

TODAY returns the current date, so you can join it to an operator just like DATE:

QuestionFormula
Dates before today (overdue)=COUNTIF(B2:B8,"<"&TODAY())
Dates from today onwards=COUNTIF(B2:B8,">="&TODAY())
Dates in the last 30 days=COUNTIFS(B2:B8,">="&TODAY()-30,B2:B8,"<="&TODAY())

These results change every day, which is the point for a tracker of overdue tasks. For a fixed report, use DATE instead so the numbers stay the same when someone opens the file next month.

Why COUNTIF with dates returns 0 or the wrong count#

Work through these causes:

  1. Cell reference inside the quotes. Use ">="&E1, not ">=E1".
  2. Dates stored as text. Imported dates are sometimes text, which COUNTIF can't compare as numbers. Real dates sit on the right of the cell by default. Fix them with Data > Text to Columns or DATEVALUE.
  3. Dates with times. A value like 31 Mar 2024 14:30 is bigger than 31 March at midnight, so "<="&DATE(2024,3,31) misses it. Use "<"&DATE(2024,4,1) as the end condition instead.
  4. Text dates in the criteria. ">=1/3/2024" may be read as 3 January instead of 1 March. Use DATE.
  5. Blank cells. COUNTIF with "<"&DATE(...) doesn't count blanks, but a criteria like "<>"&DATE(...) does. To count only filled cells, see COUNTIF not blank.

How to count dates with a second condition#

COUNTIFS can mix date conditions with conditions on other columns. Say column C holds each ticket's status:

TicketOpenedStatus
T-2021 Mar 2024Closed
T-2038 Mar 2024Open
T-20415 Mar 2024Closed
T-20529 Mar 2024Open

To count the March tickets that are still open, add a third pair:

Excel formula
=COUNTIFS(B2:B8,">="&DATE(2024,3,1),B2:B8,"<="&DATE(2024,3,31),C2:C8,"Open")

The result is 2 (T-203 and T-205). A row counts only when every condition is TRUE.

Practise it#

Dates in criteria are where many people get stuck, because of the & join and the hidden times. Practise dates in criteria in a live spreadsheet, and brush up on the basics with the COUNTIF lesson. Each lesson checks your formula instantly. Or count the March tickets in the exercise on this page.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

How many tickets were opened in March 2024? In E2, use COUNTIFS on B2:B8 with ">="&DATE(2024,3,1) and "<="&DATE(2024,3,31).

fx
ABCDEF
1
Ticket
Opened
Status
2
T-201
45348
Closed
March 2024
3
T-202
45352
Closed
4
T-203
45359
Open
5
T-204
45366
Closed
6
T-205
45380
Open
7
T-206
45384
Open
8
T-207
45397
Closed
9
10
11

Tip: Use B2:B8 twice. The first criteria is ">="&DATE(2024,3,1) and the second is "<="&DATE(2024,3,31).

Practise this in a lesson

LessonDates in criteria: totals by date range and monthCount and total rows between two dates with COUNTIFS and SUMIFS, build a monthly summary, and drive the date range from input cells.LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".Function guideCOUNTIFSCount rows that meet several conditions with COUNTIFS. Examples for text, number ranges and between-values, plus a live exercise.

Frequently asked questions

How do I count dates after a certain date in Excel?

+

Use COUNTIF with an operator joined to DATE: =COUNTIF(B2:B8,">"&DATE(2024,3,15)). This counts the dates after 15 March 2024. Use ">=" to include that day.

How do I count dates between two dates?

+

Use COUNTIFS with two conditions on the same range: =COUNTIFS(B2:B8,">="&DATE(2024,3,1),B2:B8,"<="&DATE(2024,3,31)). A date is counted only when it passes both tests.

How do I count dates in a specific month?

+

Count from the first day of the month to the last day. With the first day in E1, use =COUNTIFS(B2:B8,">="&E1,B2:B8,"<="&EOMONTH(E1,0)). EOMONTH finds the last day of that month.

How do I count dates before today?

+

Join the operator to TODAY: =COUNTIF(B2:B8,"<"&TODAY()). The result changes each day, which is useful for counting overdue items.

Why does COUNTIF with dates return 0?

+

Common causes are a cell reference written inside the quotes, dates stored as text, or dates that include a time. Check that the dates sit on the right of their cells, which shows they are real dates.

Sources

  • COUNTIFS function - Microsoft Support
  • DATE function - Microsoft Support
  • EOMONTH function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How dates work in COUNTIF criteria
  2. How to count dates before or after a date
  3. How to count dates between two dates
  4. How to count dates in a month
  5. How to use dates from cells
  6. How to count dates relative to today
  7. Why COUNTIF with dates returns 0 or the wrong count
  8. How to count dates with a second condition
  9. Practise it

Keep reading

Comparisons· 7 min read

COUNTIF vs COUNTIFS: What's the Difference?

COUNTIF counts cells that meet one condition, such as tickets marked Open. COUNTIFS counts rows that meet several conditions at once, such as Open tickets with High priority, and every condition must be true. COUNTIFS with one pair works exactly like COUNTIF, so many people simply use COUNTIFS for everything.

Conditional math· 6 min read

How to Use COUNTIF in Excel (With Criteria Examples)

COUNTIF counts the cells in a range that meet one condition. Write =COUNTIF(range, criteria), for example =COUNTIF(D2:D9,"Open") to count open tickets. Put text and comparisons in double quotes, like ">=8" or "<>Low". Numbers and cell references go in without quotes. For two or more conditions, use COUNTIFS.

Conditional math· 6 min read

Count Non-Blank Cells With a Condition in Excel

To count cells that are not blank, use =COUNTIF(C2:C8,"<>"), where "<>" means "not equal to nothing". To add a condition, use COUNTIFS: =COUNTIFS(B2:B8,"Sales",D2:D8,"<>") counts Sales rows whose column D is filled in. Use "" instead of "<>" to count the blank ones. COUNTA also counts non-blank cells, but takes no condition.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free