Excel guide · 3 min read
Count cells between two dates in Excel
=COUNTIFS(B2:B9,">="&F2,B2:B9,"<="&G2), with the start date in F2 and the end date in G2. COUNTIFS counts the rows that meet both conditions: on or after the start, and on or before the end.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Order | Order date | Amount | Status | From | To | |
| 2 | #1041 | Sep 28, 2026 | 180 | Shipped | Oct 1, 2026 | Oct 31, 2026 | |
| 3 | #1042 | Oct 1, 2026 | 95.5 | Shipped | |||
| 4 | #1043 | Oct 9, 2026 | 240 | Refunded | |||
| 5 | #1044 | Oct 15, 2026 | 62 | Shipped | |||
| 6 | #1045 | Oct 22, 2026 | 410 | Shipped | |||
| 7 | #1046 | Oct 31, 2026 | 135 | Pending | |||
| 8 | #1047 | Nov 1, 2026 | 88 | Shipped | |||
| 9 | #1048 | 10/20/2026 | 150 | Shipped |
Download this sheet as an Excel practice file (.xlsx)
COUNTIFS with a start and end date
List the date range twice, once per condition. The operator goes in quotes and joins the date cell with &: ">="&F2 means "greater than or equal to the date in F2". Keeping the dates in cells lets you change the period without touching the formula.
Five orders fall in October. The order dated 10/20/2026 in row 9 looks like it should be a sixth; see the section on text dates below.
Result: 5
5 orders were placed from October 1 to October 31.
Typing the dates into the formula
If you prefer the dates inside the formula, build them with DATE(year, month, day). It works the same in every regional setting, while a typed string like "10/1/2026" can mean January 10 on a computer set to day-first dates.
Avoid ">=F2" written inside one pair of quotes. Excel then compares against the text F2, not the date in F2, and the count is 0.
Result: 5
5 again, with no helper cells.
Add more conditions
COUNTIFS takes up to 127 range and condition pairs. Add the status column to count only shipped orders in the period. Every condition has to be true for a row to count.
To add up the amounts instead of counting rows, swap in SUMIFS, which takes the sum range first: =SUMIFS(C2:C9,B2:B9,">="&F2,B2:B9,"<="&G2) gives $942.50 for October.
Result: 3
3 October orders were shipped; one was refunded and one is pending.
Whole months without typing the last day
EOMONTH returns the last day of a month. EOMONTH(F2,-1)+1 is the first day of F2's month, and EOMONTH(F2,0) is the last day, so any date in F2 counts its whole month. This removes the classic error of typing 30 for a 31-day month.
For a report that rolls forward, put =EOMONTH(TODAY(),-1)+1 in F2 to always start at the first of the current month.
Result: 5
5: every order from October 1 to October 31.
When the dates include a time of day
A timestamp like Oct 31, 2026 2:30 PM is larger than the plain date Oct 31, 2026 (which means midnight). "<="&G2 would then miss everything that happened during the last day.
Use "less than the day after" instead. It counts the whole last day whether or not the cells contain times, so it is the safer habit.
Result: 5
5 here, because these dates have no times. With timestamps this version keeps the October 31 orders that <= would drop.
Dates stored as text are never counted
Row 9 holds 10/20/2026 as text, typed with a leading apostrophe or pasted from another system. COUNTIFS compares dates as numbers, so text dates are silently skipped. COUNT shows the problem quickly: it counts only real numbers and dates.
To fix text dates, select the column and use Data > Text to Columns > Finish, or choose the date order in step 3 of the wizard if the text is day-first.
Result: 7
7, not 8: one of the eight order dates is text, which is why the October count is 5 instead of 6.
Common mistakes
">=F2" inside one set of quotes
Join the operator to the cell: ">="&F2. Inside the quotes, F2 is just the letters F and 2.
Missing the last day
If the cells include times, use "<"&G2+1 instead of "<="&G2.
Count is lower than expected
Some dates are text. Check with =COUNT(range) and convert them with Data > Text to Columns.
Different sized ranges
Every range in COUNTIFS must be the same size, such as B2:B9 and D2:D9, or Excel returns #VALUE!.
FAQ
How do I count dates between two dates in Excel?
=COUNTIFS(range,">="&start,range,"<="&end), with the start and end dates in cells. Use the same range for both conditions.
Can I use COUNTIF instead of COUNTIFS for a date range?
Not in one condition. COUNTIF takes a single test, so you would need =COUNTIF(range,">="&start)-COUNTIF(range,">"&end). COUNTIFS is clearer.
How do I count dates in a specific month?
=COUNTIFS(range,">="&DATE(2026,10,1),range,"<"&DATE(2026,11,1)) counts October 2026. Or use EOMONTH with any date in that month.
Why does my COUNTIFS date formula return 0?
Usually the operator is not joined with &, the dates in the range are text, or the start date is after the end date.
Functions used
COUNTIFSCounts with several conditionsSUMIFSAdds with several conditionsDATEBuilds a dateEOMONTHLast day of a monthCOUNTCounts numbers
Related guides
- COUNTIFS with multiple criteria in Excel
- COUNTIFS between two numbers in Excel
- Excel dates not sorting correctly: how to fix it
- How to calculate days between two dates in Excel
- Excel formulas cheat sheet: the 25 everyone should know
- How to use SUMPRODUCT in Excel
Updated