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
- Customer Resources
- 67.1K Get Help
- 450 Global Discussions
- 155 Industry Talk
- 505 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 156 Just for fun
- 80 Community Job Board
- 514 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!