Google Sheets
How to Sum a Month of Timestamped Rows in Google Sheets
Published by OneCell
To sum a month of timestamped rows in Google Sheets, use SUMIFS with two date criteria. Include times at or after midnight on the first day of the chosen month. Stop just before midnight on the first day of the next month. This includes late entries on the last day.
Enter the example timestamps
On a tab called Orders, enter Order time in A1 and Amount in B1. The example uses fictional amounts in a single unit. Enter the formulas below to create date and time values. A date by itself represents midnight. Google’s DATE reference and TIME reference
In A2, enter
=DATE(2025, 12, 15) + TIME(9, 0, 0)and put 999 in B2.In A3, enter
=DATE(2026, 11, 30) + TIME(23, 59, 0)and put 50 in B3.In A4, enter
=DATE(2026, 12, 1)and put 120 in B4.In A5, enter
=DATE(2026, 12, 31)and put 34 in B5.In A6, enter
=DATE(2026, 12, 31) + TIME(23, 59, 0)and put 46 in B6.In A7, enter
=DATE(2027, 1, 1)and put 25 in B7.In A8, enter
=DATE(2027, 1, 18) + TIME(12, 15, 0)and put 70 in B8.
Use the Format menu to display A2:A8 with both a date and a time. Sheets stores the time as a fraction of a day, so midnight and 23:59 on the same date have different values. When typing your own timestamps, use a format your sheet recognizes as a date and time. Check that imported cells contain date and time values before including them in the sum. Google’s guide to date and time values
Set the month and calculate the total
Enter Month start in D1 and =DATE(2026, 12, 1) in E1. Enter Month total in D2 and paste this formula into E2.
=SUMIFS(B2:B8, A2:A8, ">="&$E$1, A2:A8, "<"&EDATE($E$1, 1))
The first criterion includes December 1 at midnight. EDATE($E$1, 1) advances the date in E1 by one month, to January 1, 2027. The strict less-than comparison leaves out the January 1 midnight row. Rows 4, 5 and 6 qualify, giving 200 from 120 + 34 + 46. The earlier December from 2025 also falls outside the range. Google’s SUMIFS reference and EDATE reference
A cutoff of December 31 at midnight would give 154 even with a less-than-or-equal comparison. Row 5 is exactly at that cutoff, but the 23:59 entry in row 6 is later. Using the start of January as the exclusive upper bound includes both December 31 entries.
Change an amount and check another month
With December selected, change B6 from 46 to 60. The total should rise to 214. Restore B6 to 46.
Replace E1 with
=DATE(2027, 1, 1). January now includes both rows 7 and 8, giving 95 from 25 + 70. The midnight entry that fell outside December belongs to January.Replace E1 with
=DATE(2027, 2, 1). Expect 0 because the example contains no February rows.
For your own log, enter the first day of the month in E1 and use numeric amounts in a consistent unit. When you add rows, extend the amount range and both timestamp ranges to the same last row. Change E1 whenever you want to see another month.