SUMIFS reference another sheet if date = this month
This formula worked until the new year. Any tweak I have tried breaks the formula all together. Currently the formula returns $0. There is data on source sheet it should be calculating but its not recognizing "This month AND This year"
=SUMIFS({INV TTL}, {INV Auth Date}, AND(IFERROR(MONTH(@cell), 0) = IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY())), IFERROR(YEAR(@cell), 0) = IF(MONTH(TODAY()) = 1, YEAR(TODAY()), YEAR(TODAY()))))
Any pointers would be appreciated. Thanks
Best Answer
-
Current calendar month would be:
=SUMIFS({INV TTL}, {INV Auth Date}, AND(IFERROR(MONTH(@cell), 0) = MONTH(TODAY()), IFERROR(YEAR(@cell), 0) = YEAR(TODAY())))
Have you confirmed previous month is in fact calculating correctly? The issue is in the bold portion:
=SUMIFS({INV TTL}, {INV Auth Date}, AND(IFERROR(MONTH(@cell), 0) = IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY())), IFERROR(YEAR(@cell), 0) = IF(MONTH(TODAY()) = 1, YEAR(TODAY()), YEAR(TODAY()))))
Regardless of which month we are in, the formula is calculating for the current year. So in January 2024, it is calculating for December of 2024 and NOT December of 2023 like you would expect from a "previous month" type of formula.
Answers
-
This base formula is for previous month, but it does have one issue with it. Try this instead:
=SUMIFS({INV TTL}, {INV Auth Date}, AND(IFERROR(MONTH(@cell), 0) = IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY())), IFERROR(YEAR(@cell), 0) = IF(MONTH(TODAY()) = 1, YEAR(TODAY()) - 1, YEAR(TODAY()))))
-
@Paul Newcome Thank you for taking a look at this.
I'm needing this formula to calculate this calendar month. The previous month formulas that I have are still working.
Thanks
-
Current calendar month would be:
=SUMIFS({INV TTL}, {INV Auth Date}, AND(IFERROR(MONTH(@cell), 0) = MONTH(TODAY()), IFERROR(YEAR(@cell), 0) = YEAR(TODAY())))
Have you confirmed previous month is in fact calculating correctly? The issue is in the bold portion:
=SUMIFS({INV TTL}, {INV Auth Date}, AND(IFERROR(MONTH(@cell), 0) = IF(MONTH(TODAY()) = 1, 12, MONTH(TODAY())), IFERROR(YEAR(@cell), 0) = IF(MONTH(TODAY()) = 1, YEAR(TODAY()), YEAR(TODAY()))))
Regardless of which month we are in, the formula is calculating for the current year. So in January 2024, it is calculating for December of 2024 and NOT December of 2023 like you would expect from a "previous month" type of formula.
-
I did confirm that it is infact calculating Dec 2023. So it appears the previous month sections are working. Thank you for the help with this month. That formula fixed it
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65.3K Get Help
- 445 Global Discussions
- 143 Industry Talk
- 476 Announcements
- 5K Ideas & Feature Requests
- 85 Brandfolder
- 150 Just for fun
- 72 Community Job Board
- 488 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 302 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!