Monthly Totals from Daily Data in Excel: SUMIFS, PivotTable or GROUPBY

The sales export has 48,000 rows, one per invoice line, each with a date and an amount. The monthly revenue report needs twelve numbers. One analyst uses a PivotTable, another a helper column with =TEXT(A2,"mmm-yy") and SUMIF, a third a SUMPRODUCT over MONTH(). Their March totals differ by 31,400, and it takes most of a morning to find out that invoices posted at 4:15 PM on 31 March are missing from two of them.

Turning daily data into monthly totals is the most common summary in finance Excel, and there are three good ways to do it in Excel 2021 or 365. This post compares SUMIFS, PivotTables and GROUPBY, shows the build for each, and covers the timestamp and fiscal-year problems that make the same data produce different totals.

Which to use

NeedBest fit
Monthly totals feeding a model or a fixed report layoutSUMIFS against month-end headers
Ad hoc exploration, slicing by customer or regionPivotTable
A live summary that grows with the data, no refreshGROUPBY (Microsoft 365 only)

SUMIFS is the workhorse because the report layout stays fixed while the data changes underneath it. A PivotTable is the fastest way to look at data you do not know yet. GROUPBY sits between them: formula-driven like SUMIFS, self-sizing like a PivotTable.

SUMIFS against month-end headers

Put real month-end dates across the top of the report. Each cell sums the transactions between the first and last day of its month:

=SUMIFS(Sales[Amount],
        Sales[Date], ">="&EOMONTH(C$4,-1)+1,
        Sales[Date], "<"&C$4+1)

C4 holds 31 March 2026. The lower bound is the first of the month. The upper bound is strictly before 1 April, not “on or before 31 March”. That difference is the timestamp trap.

The timestamp trap

A date with a time is a number with a decimal. 31 March 2026 at 4:15 PM is 46112.677. The criterion "<="&C$4 compares it to 46112, midnight at the start of 31 March, and excludes it. Every transaction stamped during the last day of the month falls out of the total.

Using "<"&C$4+1 (before midnight at the start of the next day) includes the whole last day whatever the time. It works for plain dates too, so use it everywhere. Check whether your data has times with =MOD(Sales[@Date],1)>0. If any row returns TRUE, any <= month-end criterion in the workbook is wrong.

The same trap catches the TEXT helper-column approach in reverse: it groups by text, so it includes the times, but it sorts “Apr-26” before “Mar-26” and breaks every date comparison downstream.

PivotTable grouping

Drop the date field in Rows. Recent versions of Excel group dates automatically into Years, Quarters and Months; right-click, Group, to choose. Two settings matter:

  • Group by Months and Years together. Months alone stack every March in the data into one row, across all years.
  • Refresh before reading. A PivotTable shows the data as of its last refresh, which refresh before you review exists to prevent.

PivotTable grouping handles timestamps correctly because it groups on the date part. Its weakness is the fiscal year: Quarters and Years follow the calendar. For a July year start, Q1 shows January to March. The PivotTable fiscal grouping post covers the fix.

GROUPBY with a month-end key

In Microsoft 365, GROUPBY produces the summary in one formula. Group by a calculated month-end for each row:

=GROUPBY(DATE(YEAR(Sales[Date]), MONTH(Sales[Date])+1, 0),
         Sales[Amount], SUM)

DATE(year, month+1, 0) returns the last day of each row’s month, the same result as EOMONTH. Use it here because EOMONTH returns #VALUE! when it is given a whole column of dates. The time is dropped automatically, because DATE builds a new whole-number date.

The result spills one row per month with a grand total, and grows when a new month appears in the data. Format the first column as dates. To show months across the top instead, use PIVOTBY with the month-end key as the column field.

GROUPBY is not in Excel 2021 or 2024, so a file built on it will show #NAME? for anyone on a perpetual license. Check who receives the file. The GROUPBY page covers the other arguments.

Fiscal months and 4-4-5 calendars

If the business closes on calendar months, all three methods work on calendar dates and the fiscal year only affects labels. If it runs a 4-4-5 or 52-53 week calendar, periods do not end on month-ends. Build a period table with each period’s start and end dates, and point SUMIFS at those dates instead of EOMONTH. For GROUPBY, look up each row’s period with XLOOKUP against the start dates (match mode -1) and group on that.

Check the totals agree

Whichever method you use, add one control: the sum of the monthly totals equals the sum of the data for the same date range.

=SUM(C10:N10) - SUMIFS(Sales[Amount], Sales[Date], ">="&EOMONTH($C$4,-1)+1, Sales[Date], "<"&$N$4+1)

It should be zero. When two methods disagree, run this on each and the one with the gap is the one dropping rows.

Where it breaks

Dates stored as text. Exports often bring dates as text, which SUMIFS ignores and PivotTables group alphabetically. Convert in Power Query or with DATEVALUE before summarizing.

Different time zones. A system that stamps in UTC puts evening transactions on the next day for a US business. Month-end cut-off follows the GL’s convention; ask what it is.

PivotTable cache size. Each PivotTable with its own cache multiplies file size. Base several PivotTables on the same source to share one cache.

Mixed month-start and month-end dates. If part of the data is dated the first of the month (budgets often are) and part on transaction dates, all three methods still work with the first-of-month to before-next-month window. A criterion of "="&C$4 does not.

Similar Posts