How to count dates within a range
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Count how many entries fall between two dates — orders this month, signups this quarter.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =COUNTIFS(A2:A100,">="&DATE(2026,7,1),A2:A100,"<"&DATE(2026,8,1)) | The < on the first of the NEXT month cleanly captures all of July, time-of-day included. |
| Google Sheets | =COUNTIFS(A2:A100,">="&DATE(2026,7,1),A2:A100,"<"&DATE(2026,8,1)) | Identical. |
| LibreOffice Calc | =COUNTIFS(A2:A100,">="&DATE(2026,7,1),A2:A100,"<"&DATE(2026,8,1)) | Identical. |
How it works
Two conditions on the same column bracket the period: on-or-after July 1 AND before August 1. In the sample (dates as their underlying serial numbers), two of the four fall inside July 2026. Using "< first of next month" instead of "<= July 31" is the safe habit — it still works when cells carry a time component like July 31, 14:30. Reference cells for the bounds by concatenating: ">="&E1.
Verified, not just documented
We ran =COUNTIFS(A2:A5,">="&DATE(2026,7,1),A2:A5,"<"&DATE(2026,8,1)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 2 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 2 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
COUNTIFS · DATE — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to check if a year is a leap year
- How to count cells between two values
- How to count with multiple criteria (COUNTIFS)
- How to get the day number of the year (1-365)
- How to use COUNTIFS (count with multiple conditions)