How-to recipes · Counting and summing
How to sum values by month in Excel
Total sales or expenses per month from a list of dates with GROUPBY in Microsoft 365, SUMIFS with a date range in any version, or a PivotTable.
Transactions are recorded with a date on every row: sales, expenses, hours worked. Reports, however, are monthly. How much did we sell in February? is a question about a range of dates, from the 1st to the last day of the month, and the number of days differs from month to month. This recipe shows how to total by month with a single formula, how to build a month-by-month summary, and which shortcuts give wrong answers once your data covers more than one year.
The example data
Eight transactions between January and March 2026 in A1:B9. The month we want is in E1 as a real date, the 1st of February 2026. The February total is 510 + 290 + 640 = 1440.
Microsoft 365: a monthly summary with GROUPBY
GROUPBY builds a whole summary table in one formula. Turn each date into a month label with TEXT and group the amounts by that label:
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Amount | |||
| 2 | 2026-01-08 | 420 | 2026-01 | 800 | |
| 3 | 2026-01-21 | 380 | 2026-02 | 1440 | |
| 4 | 2026-02-03 | 510 | 2026-03 | 1010 | |
| 5 | 2026-02-14 | 290 | |||
| 6 | 2026-02-27 | 640 | |||
| 7 | 2026-03-02 | 330 | |||
| 8 | 2026-03-19 | 475 | |||
| 9 | 2026-03-30 | 205 |
The two zeros switch off headers and the grand total row. Leave them out to get a Total row at the bottom.
The label format yyyy-mm sorts correctly across years (2025-12 before 2026-01), unlike mmm, which would sort Apr before Feb. GROUPBY is available in current Microsoft 365 builds; if you do not have it, use SUMIFS below.
Every version: SUMIFS with a start and end date
SUMIFS can add the amounts whose date is on or after the 1st of the month and before the 1st of the next month:
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Amount | Month | 2026-02-01 | |
| 2 | 2026-01-08 | 420 | Total | 1440 | |
| 3 | 2026-01-21 | 380 | |||
| 4 | 2026-02-03 | 510 | |||
| 5 | 2026-02-14 | 290 | |||
| 6 | 2026-02-27 | 640 | |||
| 7 | 2026-03-02 | 330 | |||
| 8 | 2026-03-19 | 475 | |||
| 9 | 2026-03-30 | 205 |
EDATE(E1,1) is 1 March 2026, so the formula adds dates from 1 Feb up to, but not including, 1 March.
Result: 1440
">="&E1joins the operator with the date, giving the criterion ">=46054" (the serial number of 1 Feb 2026)."<"&EDATE(E1,1)uses EDATE to move one month forward. Using less than the next month's start also includes transactions on the last day that have a time, such as 28-Feb 17:30.- You could use
"<="&EOMONTH(E1,0)with EOMONTH instead, but it misses entries on the last day that carry a time of day.
To build a monthly table in Excel 2016, type the first day of each month in a column (D2 = 2026-01-01, D3 = 2026-02-01 ...), format them as mmm yyyy so they display as Jan 2026, and copy =SUMIFS($B$2:$B$9,$A$2:$A$9,">="&D2,$A$2:$A$9,"<"&EDATE(D2,1)) down next to them.
If you only have the month number
When the report cell holds a month and a year as numbers rather than a date, build the date with DATE: ">="&DATE(2026,2,1). Another formula you will see is =SUMPRODUCT((MONTH(A2:A9)=2)*B2:B9). It works, but it adds February of every year in the data. Add the year as well: =SUMPRODUCT((MONTH(A2:A9)=2)*(YEAR(A2:A9)=2026)*B2:B9). SUMIFS with a date range is faster and safer.
PivotTable method
Select the data and choose Insert > PivotTable. Drag Date to Rows and Amount to Values. Recent versions group dates automatically into Years, Quarters and Months; if not, right-click a date in the PivotTable, choose Group, and select Months and Years. Selecting only Months would merge January 2025 with January 2026. See PivotTables: summarise thousands of rows in seconds.
Pitfalls
- Dates stored as text. If SUMIFS returns 0, the dates may be text that only looks like dates. Test with
=ISNUMBER(A2); convert them as shown in How to convert text to a date in Excel. - Month labels typed as text in the report column ("Feb") cannot be compared with dates. Use real dates formatted to show only the month.
- Mixing years with MONTH-based formulas, as explained above.
- Fiscal months that do not start on the 1st need explicit start and end dates in two cells; see How to sum values between two dates in Excel.