How to sum values from the last 7 days
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)A rolling total for a recent window — last week's sales, last 7 days of activity — that updates itself daily.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 150 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
SUMIFS · TODAY — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to calculate a year-to-date (YTD) total
- How to count business days left in the month
- How to calculate age in years from a birth date
- How to count days since a date
- How to count days until a date