Sum the Last 30 Days in Excel With SUMIFS and TODAY
By ExcelReady TeamUpdated 6 min read
The short answer
Use SUMIFS with two date conditions: =SUMIFS(C2:C100,A2:A100,">="&TODAY()-29,A2:A100,"<="&TODAY()). The first condition keeps dates from 29 days ago onwards, the second stops at today, so you get 30 days including today. The total updates every day. Put a fixed date in a cell instead of TODAY() for a report that must not change.
Key takeaways
- The formula is =SUMIFS(amounts, dates, ">="&TODAY()-29, dates, "<="&TODAY()).
- TODAY()-29 plus today makes 30 days. Use TODAY()-30 and "<"&TODAY() if today should not count.
- The operator goes in quotes and joins the date with &. Writing ">=TODAY()-29" in quotes does not work.
- For a report that must not change, put the report date in a cell and point the formula at that cell.
- Add more range and criteria pairs to SUMIFS to sum the last 30 days for one customer or category.
On this page+
To sum the last 30 days in Excel, use SUMIFS with two date conditions: one for the start of the window, TODAY()-29, and one for the end, TODAY(). The total moves forward by itself every day, so a "last 30 days sales" figure on a dashboard never needs editing. This guide shows the formula, explains why it uses 29 and not 30, and covers the fixes when the total comes out wrong.
How to sum the last 30 days with SUMIFS and TODAY#
SUMIFS adds the numbers in one column when the matching cells in other columns meet every condition you give it. For a rolling 30-day total, both conditions test the same date column:
=SUMIFS(C2:C100,A2:A100,">="&TODAY()-29,A2:A100,"<="&TODAY())| Part | What it does |
|---|---|
C2:C100 | The amounts to add (the sum range comes first in SUMIFS) |
A2:A100,">="&TODAY()-29 | Keep dates on or after the day 29 days ago |
A2:A100,"<="&TODAY() | Keep dates up to and including today |
TODAY() returns today's date with no time. Excel stores dates as whole numbers (one per day), so TODAY()-29 is simply the date 29 days earlier. The & joins the operator ">=" to that date, which builds a condition such as ">=46297" that SUMIFS can read.
The examples below use this sales table, with a fixed report date of 31 Oct 2026 in F1 so the results don't change:
| A | B | C | |
|---|---|---|---|
| 1 | Date | Customer | Amount |
| 2 | 28 Sep 2026 | Harbor Cafe | 450 |
| 3 | 1 Oct 2026 | Lime Studio | 300 |
| 4 | 2 Oct 2026 | Harbor Cafe | 275 |
| 5 | 14 Oct 2026 | Bluebird Ltd | 520 |
| 6 | 25 Oct 2026 | Lime Studio | 180 |
| 7 | 31 Oct 2026 | Bluebird Ltd | 610 |
| 8 | 3 Nov 2026 | Harbor Cafe | 400 |
=SUMIFS(C2:C8,A2:A8,">="&F1-29,A2:A8,"<="&F1)The window runs from 2 Oct to 31 Oct, so the result is 275 + 520 + 180 + 610 = 1,585. The 28 Sep and 1 Oct sales are too old, and the 3 Nov sale is after the report date. That end condition matters: without it, future-dated rows such as scheduled orders would sneak into the total.
Last 30 days: should today count?#
"The last 30 days" usually means today plus the 29 days before it, which is why the formula subtracts 29. Count it on your fingers: 2 Oct to 31 Oct is 30 days. Subtracting 30 would give 31 days.
Some reports want the 30 full days before today, because today's sales are not finished yet. Then move both ends back by one and use "less than" for the end:
=SUMIFS(C2:C8,A2:A8,">="&F1-30,A2:A8,"<"&F1)With 31 Oct as the report date, this covers 1 Oct to 30 Oct and returns 1,275 (300 + 275 + 520 + 180). Neither version is "right": pick the one your team means, and write it in the report label, for example "Last 30 days incl. today".
If your date column holds times as well as dates (for example 31 Oct 2026 14:20), "<="&TODAY() drops today's rows, because 31 Oct at 14:20 is later than 31 Oct at midnight. Use "<"&TODAY()+1 as the end condition instead. The guide on removing the time from a date explains why.
Use a report date cell instead of TODAY#
For a report that must show the same number next week, don't build TODAY() into the formula. Put the report date in a cell and point the formula at it:
- In F1, type the report date, or
=TODAY()if you do want it to move. - In F2, type
=SUMIFS(C2:C8,A2:A8,">="&F1-29,A2:A8,"<="&F1).
Now anyone can change F1 to see any 30-day window, and the formula never needs editing. This is also easier to check: the reader can see which date the total is based on. The same "date in a cell" idea drives month-to-date totals and year-to-date totals. For more on how TODAY() recalculates, see the guide to the TODAY function and the TODAY function reference.
Sum the last 30 days for one customer or category#
SUMIFS takes more conditions in pairs: a range, then its criteria. To total one customer's last 30 days, add a third pair:
=SUMIFS(C2:C8,B2:B8,"Bluebird Ltd",A2:A8,">="&F1-29,A2:A8,"<="&F1)The result is 1,130 (520 + 610). Put the customer name in a cell, such as H2, and use B2:B8,H2 instead, then fill the formula down a list of customers to get a 30-day total for each one. Lock the ranges with $ first ($C$2:$C$8) so they don't move as you fill.
The SUMIFS function guide lists every argument, and the article on summing between two dates covers fixed start and end dates.
Count, average and compare the previous 30 days#
The same two date conditions work in COUNTIFS and AVERAGEIFS, so you can build a full 30-day summary from one pattern:
| Question | Formula | Result |
|---|---|---|
| Sales in the last 30 days | =SUMIFS(C2:C8,A2:A8,">="&F1-29,A2:A8,"<="&F1) | 1,585 |
| Number of orders | =COUNTIFS(A2:A8,">="&F1-29,A2:A8,"<="&F1) | 4 |
| Average order | =AVERAGEIFS(C2:C8,A2:A8,">="&F1-29,A2:A8,"<="&F1) | 396.25 |
| Last 7 days | =SUMIFS(C2:C8,A2:A8,">="&F1-6,A2:A8,"<="&F1) | 790 |
| Previous 30 days (days 31 to 60) | =SUMIFS(C2:C8,A2:A8,">="&F1-59,A2:A8,"<="&F1-30) | 750 |
The last row lets you compare this month's rolling total with the one before: 1,585 against 750. For more counting patterns, read COUNTIFS with a date range.
Why is the last-30-days total wrong or 0?#
A SUMIFS date formula returns 0 or a strange total for a handful of reasons. Check these in order:
- The whole condition is inside quotes.
">=TODAY()-29"is just text to Excel and matches nothing. Keep only the operator in quotes and join with&:">="&TODAY()-29. - The dates are text. Dates imported from another system often look right but sit on the left of the cell. SUMIFS can't compare them to a date. Convert them first; converting text to dates shows how.
- The ranges are swapped or different sizes. In SUMIFS the sum range is first. All ranges must be the same size, or Excel shows #VALUE!.
- Dates include times. Today's rows drop out with
"<="&TODAY(). Use"<"&TODAY()+1. - The window is off by one. A total that looks one day too long or short usually means 30 where you wanted 29, or the other way round.
Practise it#
Date criteria are a common job-test task because they combine three skills: SUMIFS, operators in quotes and the & join. Practise dates in criteria in a live spreadsheet: you type the formula and it checks it instantly. Then build multi-condition totals in the COUNTIFS and SUMIFS lesson, or try the exercise on this page first.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
The report date is in F1. In F2, use SUMIFS to add the Amount (C2:C8) for sales dated from F1-29 up to F1, then press Enter.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Amount | ||||||
| 2 | Last 30 days | ||||||
| 3 | |||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 |
Tip: Sum range first, then the date range twice: ">="&F1-29 for the start and "<="&F1 for the end.
Practise this in a lesson
Frequently asked questions
How do I sum the last 30 days in Excel?
Use =SUMIFS(C2:C100,A2:A100,">="&TODAY()-29,A2:A100,"<="&TODAY()), where column A holds the dates and column C the amounts. It adds every amount dated from 29 days ago up to and including today.
Should I use TODAY()-29 or TODAY()-30?
TODAY()-29 to TODAY() is 30 days including today. If you want the 30 full days before today and not today itself, use ">="&TODAY()-30 with "<"&TODAY().
Why does my last 30 days SUMIFS return 0?
The usual causes are dates stored as text, the whole condition written inside quotes such as ">=TODAY()-29", or ranges that point at the wrong columns. Check that the dates are real dates and that the operator is joined to TODAY() with &.
How do I count the orders in the last 30 days?
Use COUNTIFS with the same two date conditions: =COUNTIFS(A2:A100,">="&TODAY()-29,A2:A100,"<="&TODAY()). It counts the rows instead of adding the amounts.
Does the last 30 days formula update by itself?
Yes. TODAY() recalculates whenever the workbook opens or recalculates, so the 30-day window moves forward each day. To freeze a result, use a fixed date in a cell or paste the result as a value.