← All how-to recipes

How to sum values from the last 7 days

✓ Verified in LibreOffice 25.8.7.3

A rolling total for a recent window — last week's sales, last 7 days of activity — that updates itself daily.

The formula

AppFormulaNotes
Excel=SUMIFS(B2:B100,A2:A100,">="&(TODAY()-6),A2:A100,"<="&TODAY())A = dates, B = amounts. TODAY()-6 through TODAY() is a 7-day window including today.
Google Sheets=SUMIFS(B2:B100,A2:A100,">="&(TODAY()-6),A2:A100,"<="&TODAY())Identical.
LibreOffice Calc=SUMIFS(B2:B100,A2:A100,">="&(TODAY()-6),A2:A100,"<="&TODAY())Identical.

How it works

SUMIFS with two date conditions brackets a window: on-or-after the start and on-or-before the end. For a live rolling week, TODAY()-6 to TODAY() slides forward automatically every day (the verification pins the window to July 24-30, 2026, where two dated rows fall inside and total 100+50 = 150; the older row is excluded). Concatenating the date with & is what lets the criteria reference a calculated date. Change the 6 for other windows (29 for a rolling 30 days), or drop the upper bound to mean 'since 7 days ago'. Because SUMIFS uses real date comparisons, the source column must contain actual dates, not text.

Verified, not just documented

We ran =SUMIFS(B2:B4,A2:A4,">="&DATE(2026,7,24),A2:A4,"<="&DATE(2026,7,30)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 150 — exactly the expected result. Every formula here is confirmed by actually executing it.