How-to recipes · Counting and summing

How to sum values between two dates in Excel

Add up amounts whose date falls between a start and an end date with SUMIFS, including the end date, plus FILTER and SUMPRODUCT alternatives.

Beginner SUMIFS SUM FILTER SUMPRODUCT TODAY DATE COUNTIFS

Payroll periods, project phases, a promotion that ran from the 5th to the 18th, the last 30 days: many questions are about a total between two dates that do not line up with whole months. You want to type a start date and an end date in two cells and see the total for that period immediately. SUMIFS handles this in every version of Excel since 2007, and Microsoft 365 adds a more visual alternative.

The example data

Invoices for March 2026 in A1:B8. The period starts on 5 March (E1) and ends on 18 March (E2), both days included. The invoices in that period are 410, 175, 620 and 300, so the total is 1505.

Every version: SUMIFS with two date conditions

E3fx=SUMIFS(B2:B8,A2:A8,">="&E1,A2:A8,"<="&E2)
ABCDE
1DateAmountFrom2026-03-05
22026-03-01250To2026-03-18
32026-03-05410Total1505
42026-03-09175
52026-03-12620
62026-03-18300
72026-03-2295
82026-03-28480

Both conditions apply to the same date column: on or after the start, and on or before the end.

Result: 1505

  • B2:B8: the amounts to add (first argument in SUMIFS).
  • A2:A8,">="&E1: dates greater than or equal to the start. The & joins the operator text with the date in E1.
  • A2:A8,"<="&E2: dates less than or equal to the end.
Watch out. Do not write the criterion as ">=E1". Inside quotes, E1 is just two letters, not a cell reference, and the result will be 0. The operator goes inside the quotes and the cell reference goes outside, joined with &.

When the dates include a time

Data exported from tills, web shops and timesheets often stores the date and time, for example 18-Mar-2026 14:35. That is larger than 18-Mar-2026 (which means midnight), so "<="&E2 would leave it out. Compare with the start of the next day instead:

Formula
=SUMIFS(B2:B8,A2:A8,">="&E1,A2:A8,"<"&E2+1)

This version is correct for both pure dates and date-times, so it is a good habit to use it always.

Microsoft 365: SUM + FILTER

FILTER lets you see the rows behind the total. =FILTER(A2:B8,(A2:A8>=E1)*(A2:A8<=E2)) spills the four invoices in the period; wrap it in SUM to get the total: =SUM(FILTER(B2:B8,(A2:A8>=E1)*(A2:A8<=E2),0)). The final 0 makes the sum 0 instead of #CALC! when no invoice falls in the period. The SUMIFS formula is still the faster choice for large data.

Rolling periods: the last 30 days

Combine the same pattern with TODAY so the period moves every day:

Formula
=SUMIFS(B2:B8,A2:A8,">"&TODAY()-30,A2:A8,"<="&TODAY())

For a fixed calendar period you can also build dates in the formula with DATE: ">="&DATE(2026,3,5). Avoid typing dates as text in the criteria, such as ">=05/03/2026", because the result depends on the regional settings of the computer that opens the file.

Older alternative: SUMPRODUCT

Before SUMIFS existed (Excel 2003), the usual formula was =SUMPRODUCT((A2:A8>=E1)*(A2:A8<=E2)*B2:B8). You will still see it. It gives the same result, and it is useful when the condition needs a calculation on the dates, for example only weekdays: =SUMPRODUCT((A2:A8>=E1)*(A2:A8<=E2)*(WEEKDAY(A2:A8,2)<6)*B2:B8).

Counting instead of summing

To count how many invoices fall in the period, use COUNTIFS with the same two conditions: =COUNTIFS(A2:A8,">="&E1,A2:A8,"<="&E2) returns 4. Divide the sum by the count for the average invoice, or use AVERAGEIFS directly.

Pitfalls

  • Text dates. Dates imported as text are ignored by SUMIFS, so the total comes out too low or 0. Test with =ISNUMBER(A2) and convert with How to convert text to a date in Excel.
  • Start after end. If someone swaps the dates, the result is 0 with no warning. Add a check such as =IF(E1>E2,"Check the dates",SUMIFS(...)).
  • Inclusive or exclusive. Decide whether the end date is included and say so next to the input cells. The examples above include both ends.
  • Blank start or end cell. An empty E1 means date 0 (January 1900), so everything up to the end date is included, which may or may not be what you want.
Tip. For whole months, see How to sum values by month in Excel; to count working days between the two dates, see How to count working days between two dates in Excel. How Excel stores dates is explained in Dates and times: serial numbers, date math and working days.
⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 12 KB

More how-to recipes