Calculate column running total from ONLY last 12 months
I want my columns to be like this..
Column A (Month & Year) Column B ($ in) and Column 3 (Running total from last twelve months)
Any help would be appreciated! Thanks🦓
Best Answer
-
Missed that see below formula:
=IF([Month & Year]@row <> "", SUMIFS([$ in]:[$ in], [Month & Year]:[Month & Year], IFERROR(@cell, "") > DATE(YEAR([Month & Year]@row) - 1, MONTH([Month & Year]@row), DAY([Month & Year]@row)), [ROW#]:[ROW#], <=[ROW#]@row))
If you know that you will always have the dates in order you can get rid of the extra columns mentioned previously (LINE-ID and ROW#) and you can use the below formula. With this formula it ignores where the row is on your list and only looks at the date. So if the dates are not in order the running total could look off.
=IF([Month & Year]@row <> "", SUMIFS([$ in]:[$ in], [Month & Year]:[Month & Year], AND(IFERROR(@cell, "") > DATE(YEAR([Month & Year]@row) - 1, MONTH([Month & Year]@row), DAY([Month & Year]@row)), @cell <= [Month & Year]@row)))
Answers
-
Assuming your Column A is a date formatted column, then:
Add the below 2 helper columns:
- "LINE-ID" : Auto Number Column
- "ROW#" : Column Formula: "=MATCH([LINE-ID]@row, [LINE-ID]:[LINE-ID], 0)
In your column 3 use the below column formula:
=SUMIFS([$ in]:[$ in], [Month & Year]:[Month & Year], IFERROR(YEAR(@cell), "") = IFERROR(YEAR([Month & Year]@row), ""), [ROW#]:[ROW#], <=[ROW#]@row)
-
This is really helpful! And almost there...
I get this...
but what I want to happen is that Feb 21 contains 2536... since it has added the last twelve months not just the last calendar year...? Thoughts?
-
Missed that see below formula:
=IF([Month & Year]@row <> "", SUMIFS([$ in]:[$ in], [Month & Year]:[Month & Year], IFERROR(@cell, "") > DATE(YEAR([Month & Year]@row) - 1, MONTH([Month & Year]@row), DAY([Month & Year]@row)), [ROW#]:[ROW#], <=[ROW#]@row))
If you know that you will always have the dates in order you can get rid of the extra columns mentioned previously (LINE-ID and ROW#) and you can use the below formula. With this formula it ignores where the row is on your list and only looks at the date. So if the dates are not in order the running total could look off.
=IF([Month & Year]@row <> "", SUMIFS([$ in]:[$ in], [Month & Year]:[Month & Year], AND(IFERROR(@cell, "") > DATE(YEAR([Month & Year]@row) - 1, MONTH([Month & Year]@row), DAY([Month & Year]@row)), @cell <= [Month & Year]@row)))
-
Thanks that worked!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.3K Get Help
- 422 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 143 Just for fun
- 59 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!