To total expenses between two dates, put a from-date in one cell and a to-date in another, and use SUMIFS with ">="&from and "<="&to. With dates in A2:A500 and amounts in E2:E500, =SUMIFS($E$2:$E$500,$A$2:$A$500,">="&$H$1,$A$2:$A$500,"<="&$H$2) works in both Excel and Google Sheets.
How do I set up the input cells?
- Type From in G1 and a real date in H1, for example the first of April.
- Type To in G2 and a real date in H2, for example the last day of the quarter.
- Type Total in G3 and enter the formula in H3.
- Format H1 and H2 as dates. If they are left-aligned, they are text and will not work.
- =SUMIFS($E$2:$E$500,$A$2:$A$500,">="&$H$1,$A$2:$A$500,"<="&$H$2)
- >= includes the from-date, and <= includes the to-date.
What do the operators do?
| Operator | Meaning | Use it for |
|---|---|---|
| >= | On or after | The first day of the range |
| <= | On or before | The last day, when dates have no time |
| < | Strictly before | The day after the last day, when times may exist |
| > | Strictly after | Rarely needed here |
The ampersand joins the operator, in quotes, to the date in the cell. Without it the formula is invalid, because the operator text and the cell value have to be joined into one criterion.
Why did my last day go missing?
Some exports store a date and a time together, such as 31 March at 2:35 pm. Excel stores that as a number with a fraction. 31 March at midnight is a smaller number than 31 March at 2:35 pm, so a row stamped 2:35 pm fails the test "<=31 March". The row looks as if it is inside the range, but the formula quietly leaves it out.
The fix is to test for before the day after: ">="&$H$1 and "<"&($H$2+1). Adding 1 moves to the next midnight, so every moment of the last day is counted. The formula becomes the one below.
- =SUMIFS($E$2:$E$500,$A$2:$A$500,">="&$H$1,$A$2:$A$500,"<"&($H$2+1))
How do I find out whether my dates have times?
Enter =SUMPRODUCT(--($A$2:$A$500<>INT($A$2:$A$500))) in any spare cell. It counts rows where the date has a time part. A result of zero means all dates are plain dates. A positive number means you should use the "<"&($H$2+1) form. If the formula returns an error, some cells in the column hold text.
What does a worked example show?
Say the three rows between 1 and 31 March are ₹1,500 on 1 March, ₹2,250 on 15 March and ₹3,000 on 31 March at 2:35 pm. With "<="&H2, where H2 is 31 March, the third row is dropped and the total shows 1,500 + 2,250 = ₹3,750. With "<"&(H2+1), the total shows 1,500 + 2,250 + 3,000 = ₹6,750. The difference of ₹3,000 is exactly the missing row.
How do I count the rows as well as the total?
A total without a row count can hide problems. Put the same two date tests in COUNTIFS: =COUNTIFS($A$2:$A$500,">="&$H$1,$A$2:$A$500,"<"&($H$2+1)). Compare the count with the number of rows you can see when you filter the date column to the same range. If the formula says 41 and the filter shows 43, two rows have text dates or sit outside the range you think they do.
Do the same check whenever you paste in a fresh export, because a new file can change how dates arrive.
Can I use this for a financial year?
- From: =DATE(2026,4,1) for 1 April.
- To: =DATE(2027,3,31) for 31 March.
- Change both and the same formula answers for any year.
- Add a category condition with $C$2:$C$500,$H$3 as another pair if you want one category.
Once statements arrive from more than one account, SpendixAI offers a Report builder that filters by date and groups spending, so you can compare it with the sheet and see whether the two agree.
Useful ideas start with a clearer picture of your own spending.
Explore your reports


