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.

Intermediate GROUPBY TEXT SUMIFS EDATE EOMONTH DATE SUMPRODUCT MONTH YEAR

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:

D2fx=GROUPBY(TEXT(A2:A9,"yyyy-mm"),B2:B9,SUM,0,0)
ABCDE
1DateAmount
22026-01-084202026-01800
32026-01-213802026-021440
42026-02-035102026-031010
52026-02-14290
62026-02-27640
72026-03-02330
82026-03-19475
92026-03-30205

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:

E2fx=SUMIFS(B2:B9,A2:A9,">="&E1,A2:A9,"<"&EDATE(E1,1))
ABCDE
1DateAmountMonth2026-02-01
22026-01-08420Total1440
32026-01-21380
42026-02-03510
52026-02-14290
62026-02-27640
72026-03-02330
82026-03-19475
92026-03-30205

EDATE(E1,1) is 1 March 2026, so the formula adds dates from 1 Feb up to, but not including, 1 March.

Result: 1440

  • ">="&E1 joins 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.
Tip. For totals by category instead of by period, see How to sum by category in Excel. Background on how Excel stores dates is in Dates and times: serial numbers, date math and working days, and on SUMIFS in Counting and summing with criteria: COUNTIFS, SUMIFS, SUMPRODUCT.
⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

More how-to recipes