# How to count dates by quarter in Excel

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))`.

**Excel:** `=COUNTIFS(B2:B13,">="&DATE(G1,G2*3-2,1),B2:B13,"<"&DATE(G1,G2*3+1,1))` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E | F | G |
| --- | --- | --- | --- | --- | --- | --- |
| Deal | Close date |  |  |  | Year | 2026 |
| D-501 | 2025-05-14 |  |  |  | Quarter | 2 |
| D-502 | 2025-11-03 |  |  |  | Deals closed |  |
| D-503 | 2026-01-15 |  |  |  |  |  |
| D-504 | 2026-02-28 |  |  |  |  |  |
| D-505 | 2026-03-31 |  |  |  |  |  |
| D-506 | 2026-04-01 |  |  |  |  |  |
| D-507 | 2026-04-22 |  |  |  |  |  |
| D-508 | 2026-05-09 |  |  |  |  |  |
| D-509 | 2026-06-30 |  |  |  |  |  |
| D-510 | 2026-07-01 |  |  |  |  |  |
| D-511 | 2026-08-18 |  |  |  |  |  |
| D-512 | 2026-09-05 |  |  |  |  |  |

Formula in G3: `=COUNTIFS(B2:B13,">="&DATE(G1,G2*3-2,1),B2:B13,"<"&DATE(G1,G2*3+1,1))`

Result: 4

## 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.

## Other ways

- `=SUMPRODUCT((YEAR(B2:B13)=G1)*(ROUNDUP(MONTH(B2:B13)/3,0)=G2))`: 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))`: 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)`.

## 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.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/count-dates-by-quarter
