For a rolling window, use SUMIFS with two date tests: on or after TODAY() minus the number of days, and on or before TODAY(). A 30-day window that includes today starts at TODAY()-29, not TODAY()-30. The result changes every day because TODAY() recalculates whenever the file opens or edits.
The formula for the last 30 days
Assume dates in column A, amounts in column C, rows 2 to 500:
=SUMIFS($C$2:$C$500,$A$2:$A$500,">="&TODAY()-29,$A$2:$A$500,"<="&TODAY())
The ampersand joins the symbol to the number that TODAY()-29 produces. The second test keeps out future-dated entries, such as a rent payment you have already logged for next week. This works the same in Excel and Google Sheets, where you can use it to sum the last n days as well.
Why 29 and not 30?
Count it. If today is the 20th, then 20 minus 29 days is the 22nd of the previous month in a 31-day month, and from the 22nd to the 20th inclusive is 30 calendar days. With 30 in the formula you would be counting 31 days, because the starting day itself is included by the greater-than-or-equal test. This is the classic off-by-one slip. For an exclusive window, such as 30 full days before today, use ">="&TODAY()-30 and "<"&TODAY().
How do I get 7, 30 and 90 days from one formula?
Put the number of days in a cell, say E1, and use:
=SUMIFS($C$2:$C$500,$A$2:$A$500,">="&(TODAY()-$E$1+1),$A$2:$A$500,"<="&TODAY())
Change E1 to 7, 30 or 90, or copy the formula into three cells each pointing at its own day count. The brackets make the subtraction finish before the text is joined. Worked dates, if today is 20 October 2025:
| Window | Days in E1 | Starts on | Ends on |
|---|---|---|---|
| Last 7 days | 7 | 14 Oct 2025 | 20 Oct 2025 |
| Last 30 days | 30 | 21 Sep 2025 | 20 Oct 2025 |
| Last 90 days | 90 | 23 Jul 2025 | 20 Oct 2025 |
Check the 7-day line: 20 minus 6 is the 14th, so the window is the 14th to the 20th, seven days including both ends. For 90 days, going back 89 days from 20 October lands on 23 July.
Why does my number change when I open the file?
TODAY() is a volatile function: the spreadsheet recalculates it every time it opens and whenever something changes. A total that read ₹18,400 yesterday may read ₹17,900 today because an expensive day has slipped out of the window and a cheaper day came in. That is the point of a rolling window, but it means a screenshot or a pasted number is a snapshot, not a record. If you need to remember the figure, copy the cell and paste it as values into a log with a date beside it.
Can I do this by category?
Yes. Add the category range and name as another pair of arguments: $B$2:$B$500,"Groceries". Put the category names down a column and the day counts across a row, and a single formula with mixed references fills the whole grid. That gives a quick table such as groceries for the last 7, 30 and 90 days, which is a useful way to see whether a spike is recent.
What about a calendar-month alternative?
A rolling window and a calendar month answer different questions. The rolling figure asks how fast money has gone out lately, whatever the date; the calendar month matches your bills and budget. Use the rolling total as a pulse check, say weekly, and the calendar total for budgeting. Putting both next to each other in a small dashboard block is often enough.
Before you trust it
- Dates are real dates, not text.
- You have chosen inclusive or exclusive of today and are sticking to it.
- Future-dated entries are excluded by the end condition.
- You know the result moves daily and have saved a snapshot where needed.
If the log is the part that falls behind, SpendixAI offers a dashboard and insights on the Free plan once you import statements, so a recent-spending view does not rely on a hand-maintained sheet.
Useful ideas start with a clearer picture of your own spending.
Explore your reports

