How to count dates by quarter in Excel
Formula (Excel and Google Sheets)
=COUNTIFS(B2:B13,">="&DATE(G1,G2*3-2,1),B2:B13,"<"&DATE(G1,G2*3+1,1))Turn the year and quarter into a date range: =COUNTIFS(B2:B13,">="&DATE(G1,G2*3-2,1),B2:B13,"<"&DATE(G1,G2*3+1,1)).
- Result on the example
- 4 in
G3 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in G3. Change any input and the result updates, or edit the formula to experiment.
How it works
Quarter 2 starts in month 2*3-2 = 4 (April) and the next quarter starts in month 2*3+1 = 7 (July). DATE turns those into real dates, and COUNTIFS counts close dates from April 1 up to, but not including, July 1.
D-501 also closed in a second quarter, but of 2025, so the year keeps it out.
=COUNTIFS(B2:B13,">="&DATE(G1,G2*3-2,1),B2:B13,"<"&DATE(G1,G2*3+1,1))Result4
B2:B1312 rows × 1 col: 5/14/2025, 11/3/2025, 1/15/2026, 2/28/2026, …A range: 12 cells in one column.
G12026The value in G1.
G22The value in G2.
G2*36The * operator multiplies.
G2*3-24The - operator subtracts.
DATE(G1,G2*3-2,1)4/1/2026 (46113)DATE: Builds a date from parts.- year
G12026 - month
G2*3-24 - day
1
- year
">="&DATE(G1,G2*3-2,1)">=46113"The & operator joins as text.
G2*36The * operator multiplies.
G2*3+17The + operator adds.
DATE(G1,G2*3+1,1)7/1/2026 (46204)DATE: Builds a date from parts.- year
G12026 - month
G2*3+17 - day
1
- year
"<"&DATE(G1,G2*3+1,1)"<46204"The & operator joins as text.
COUNTIFS(B2:B13,">="&DATE(G1,G2*3-2,1),B2:B13,"<"&DATE(G1,G2*3+1,1))4COUNTIFS: Counts rows that meet every condition.- criteria_range1
B2:B1312 rows × 1 col: 5/14/2025, 11/3/2025, 1/15/2026, 2/28/2026, … - criteria1
">="&DATE(G1,G2*3-2,1)">=46113" - criteria_range2
B2:B1312 rows × 1 col: 5/14/2025, 11/3/2025, 1/15/2026, 2/28/2026, … - criteria2
"<"&DATE(G1,G2*3+1,1)"<46204"
- criteria_range1
In Google Sheets
The same formula works in Google Sheets: =COUNTIFS(B2:B13,">="&DATE(G1,G2*3-2,1),B2:B13,"<"&DATE(G1,G2*3+1,1)). We ran it in Google Sheets mode on the same data and it returns 4.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =SUMPRODUCT((YEAR(B2:B13)=G1)*(ROUNDUP(MONTH(B2:B13)/3,0)=G2)) | 4 | Works out each date's quarter: months 1 to 3 give 1, 4 to 6 give 2, and so on. Readable, and the same idea gives a quarter column: =ROUNDUP(MONTH(B2)/3,0). |
| =SUMPRODUCT(--(ROUNDUP(MONTH(B2:B13)/3,0)=G2)) | 5Different result | Ignores the year: use it to compare the same quarter across years. Also counts D-501 from the second quarter of 2025. |
Common mistakes
DATE(G1,13,1)is fine: DATE rolls month 13 over to January of the next year, so quarter 4 works without a special case.- Fiscal quarters that don't start in January need an offset. For a year starting in July, the fiscal quarter is
=ROUNDUP(MONTH(EDATE(B2,-6))/3,0).
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Count dates by quarter
G3, count the deals that closed in the quarter in G2 of the year in G1.Questions
How do I show the quarter as text like "Q2 2026"?
Use ="Q"&ROUNDUP(MONTH(B2)/3,0)&" "&YEAR(B2).
How do I count every quarter in a table?
List the quarter numbers 1 to 4 in a column and fill the COUNTIFS formula down, pointing G2 at that column.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.