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. Dates
  3. How to Count Dates by Month in Excel

How to Count Dates by Month in Excel

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

The short answer

To count dates by month in Excel, use COUNTIFS with a date range: put the first day of the month in E2 and use =COUNTIFS(B2:B100,">="&E2,B2:B100,"<="&EOMONTH(E2,0)). EOMONTH(E2,0) returns the last day of that month. Fill the formula down next to a list of month start dates to build a monthly summary. Add more pairs for extra conditions.

Key takeaways

  • Count one month with =COUNTIFS(dates,">="&E2,dates,"<="&EOMONTH(E2,0)), where E2 is the 1st of the month.
  • Join operators to dates with &: ">="&E2, never ">=E2".
  • If dates include times, use "<"&EOMONTH(E2,0)+1 so the last day is fully counted.
  • SUMPRODUCT(--(MONTH(dates)=3)) counts March in every year, and counts blank cells as January.
  • A PivotTable grouped by months and years gives a monthly count with no formulas.
On this page+
  1. How to count dates in one month with COUNTIFS
  2. How to use a month cell and EOMONTH
  3. How to count by month with another condition
  4. What if the dates include times?
  5. How to count by month number with SUMPRODUCT
  6. How to count by month with a PivotTable
  7. Common mistakes when counting by month
  8. Practise it

To count by month in Excel, give COUNTIFS a date range: every date on or after the first day of the month, and on or before the last day. EOMONTH works out the last day for you, so one formula fills down a whole monthly summary. This guide shows that method, how to add more conditions, and when SUMPRODUCT or a PivotTable is the better choice.

How to count dates in one month with COUNTIFS#

Count the dates between the first and last day of the month. COUNTIFS counts rows that meet every condition you give it, and you can test the same column twice. Here's the order list the examples use:

ABC
1OrderDateRegion
2100127/02/2025East
3100203/03/2025West
4100315/03/2025East
5100431/03/2025East
6100502/04/2025West
7100620/03/2024East
8100709/03/2025West

To count orders in March 2025:

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

The result is 4: orders 1002, 1003, 1004 and 1007. Order 1006 is in March too, but in 2024, so it's left out. A date range always checks the year as well as the month.

Notice the &. The operator goes in quotes and is joined to the date. Writing ">=DATE(2025,3,1)" wouldn't work, because inside quotes the formula is just text. The COUNTIFS function guide covers the syntax, and the comparison of COUNTIF and COUNTIFS shows when you need the multi-condition version.

How to use a month cell and EOMONTH#

Put the first day of the month in a cell and let EOMONTH find the last day. EOMONTH returns the last day of a month; with 0 as its second argument, it's the same month as the date you give it:

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

If E2 holds 1 March 2025, EOMONTH(E2,0) is 31 March 2025, and the result is again 4. You never have to remember whether a month has 30 or 31 days, or whether February has 29. The EOMONTH function guide has more examples.

To build a monthly summary, list month start dates down column E and fill the formula down with locked ranges:

EF
1MonthOrders
2Feb 20251
3Mar 20254
4Apr 20251

The formula in F2 is =COUNTIFS($B$2:$B$8,">="&E2,$B$2:$B$8,"<="&EOMONTH(E2,0)). The month cells hold real dates (1 February, 1 March, 1 April) with a custom format of mmm yyyy. To generate the list, type the first month in E2 and put =EDATE(E2,1) in E3, then fill down.

How to count by month with another condition#

Add another range and criteria pair. To count only East orders in March 2025:

Excel formula
=COUNTIFS(B2:B8,">="&E2,B2:B8,"<="&EOMONTH(E2,0),C2:C8,"East")

The result is 2: orders 1003 and 1004. You can keep adding pairs, such as a product or a status, and COUNTIFS counts only the rows that match all of them. The guide to COUNTIFS and SUMIFS with multiple conditions has more examples.

To add up amounts by month instead of counting rows, use SUMIFS with the same date criteria. That's covered in how to sum by month.

What if the dates include times?#

If your dates include times, use "less than the first day of the next month" for the end. A timestamp like 31/03/2025 14:30 is stored as a number slightly larger than 31/03/2025, so "<="&EOMONTH(E2,0) misses it.

This version counts the whole last day:

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

EOMONTH(E2,0)+1 is 1 April, and "less than 1 April" includes every moment of 31 March. It works for plain dates too, so it's a safe habit for system exports and logs.

How to count by month number with SUMPRODUCT#

SUMPRODUCT can test MONTH directly, without start and end dates. To count every March date:

Excel formula
=SUMPRODUCT(--(MONTH(B2:B8)=3))

MONTH returns the month number of each date, the comparison gives TRUE or FALSE, and -- turns those into 1s and 0s for SUMPRODUCT to add up. On the order list, the result is 5, not 4, because MONTH ignores the year and includes March 2024.

Add a YEAR test to fix that:

Excel formula
=SUMPRODUCT((MONTH(B2:B8)=3)*(YEAR(B2:B8)=2025))

This returns 4. Watch out for blank cells: MONTH of an empty cell is 1, so empty rows count as January. That's one more reason COUNTIFS with a date range is usually the safer choice.

How to count by month with a PivotTable#

A PivotTable builds a monthly count without formulas. Select the data, go to Insert > PivotTable, and drag Date to Rows and Order to Values. Set the value to Count.

Newer Excel versions group dates by year, quarter and month automatically. If not, right-click a date in the PivotTable, choose Group, and select Months and Years. Always include years when your data covers more than one, or March 2024 and March 2025 end up in the same row.

Common mistakes when counting by month#

Most wrong counts come from criteria syntax, years or text dates. Check these:

  1. Operator and date not joined. Use ">="&E2, not ">=E2".
  2. Month cell isn't the 1st. If E2 holds 15 March, the count starts mid-month. Use =DATE(YEAR(A2),MONTH(A2),1) to get the 1st.
  3. Years mixed together. MONTH-based formulas combine years. Use date ranges or add a YEAR test.
  4. Text dates. Dates stored as text are never counted. Convert them to real dates.
  5. Ranges of different sizes. Every range in COUNTIFS must cover the same rows, or you get #VALUE!.

For filtering the matching rows rather than counting them, see how to filter by date, and for any custom period, summing between two dates.

Practise it#

Monthly counts and totals are among the most common tasks in data and reporting job tests. Practise using dates in criteria in a live spreadsheet, then practise COUNTIFS and SUMIFS with several conditions. Each formula is checked instantly. Or try the exercise on this page first.

Try it yourself

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

E2 holds the first day of March 2025. How many orders were placed in that month? Click F2 and use COUNTIFS on the dates in B2:B8: on or after E2, and on or before EOMONTH(E2,0).

fx
ABCDEFG
1
Order
Date
Region
Month
Orders
2
1001
45715
East
45717
3
1002
45719
West
4
1003
45731
East
5
1004
45747
East
6
1005
45749
West
7
1006
45371
East
8
1007
45725
West
9
10
11

Tip: Each condition is a range and a criteria. Join the operator to the date with &, like ">="&E2.

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.LessonCOUNTIFS and SUMIFSCount and sum with several conditions at once, and learn why SUMIFS puts the sum range first.Function guideCOUNTIFSCount rows that meet several conditions with COUNTIFS. Examples for text, number ranges and between-values, plus a live exercise.Function guideEOMONTHFind the last day of any month with Excel's EOMONTH for due dates, month totals and days in a month. Examples, pitfalls and a live exercise.

Frequently asked questions

How do I count the number of dates in a month in Excel?

+

Use COUNTIFS with the first and last day of the month: =COUNTIFS(B2:B100,">="&DATE(2025,3,1),B2:B100,"<="&DATE(2025,3,31)). Or put the first day in a cell and use EOMONTH for the last day.

How do I count by month and year in Excel?

+

Use a date range with COUNTIFS, which checks the year automatically. Or use =SUMPRODUCT((MONTH(B2:B100)=3)*(YEAR(B2:B100)=2025)) to test the month and the year separately.

Why does my month count include the wrong year?

+

MONTH only returns 1 to 12, so a test like MONTH(B2:B100)=3 counts March in every year. Add a YEAR test, or switch to COUNTIFS with start and end dates.

How do I count by month with another condition?

+

Add another range and criteria pair to COUNTIFS: =COUNTIFS(B2:B100,">="&E2,B2:B100,"<="&EOMONTH(E2,0),C2:C100,"East") counts only the East rows in that month.

Sources

  • COUNTIFS function - Microsoft Support
  • EOMONTH function - Microsoft Support
  • SUMPRODUCT 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 to count dates in one month with COUNTIFS
  2. How to use a month cell and EOMONTH
  3. How to count by month with another condition
  4. What if the dates include times?
  5. How to count by month number with SUMPRODUCT
  6. How to count by month with a PivotTable
  7. Common mistakes when counting by month
  8. Practise it

Keep reading

Conditional math· 6 min read

How to Sum by Month in Excel With SUMIFS

To sum by month in Excel, put the first day of the month in a cell, such as D2, and use SUMIFS with two date conditions: =SUMIFS(B2:B8,A2:A8,">="&D2,A2:A8,"<="&EOMONTH(D2,0)). EOMONTH returns the last day of that month, so the formula adds every amount dated from the 1st to the month end. Fill it down for a monthly summary.

Conditional math· 7 min read

Sum by Date Range or Month in Excel With SUMIFS

To sum between two dates, give SUMIFS the same date column twice: once with ">="&start and once with "<"&end. For January 2025, write =SUMIFS(D2:D9,A2:A9,">="&DATE(2025,1,1),A2:A9,"<"&DATE(2025,2,1)). Keep the operator in quotes and join the date with &. Using "before the 1st of next month" works for every month.

Dynamic arrays· 6 min read

FILTER by Date in Excel: Month, Range or Recent

To filter by date in Excel with a formula, give FILTER two date tests multiplied together. For March 2024: =FILTER(A2:C9,(A2:A9>=DATE(2024,3,1))*(A2:A9<=DATE(2024,3,31))). Put the start and end dates in cells to change the range without editing the formula. For recent rows, use A2:A9>=TODAY()-30. FILTER needs Excel 2021, Excel 2024 or Microsoft 365.

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