Dealing with Date Ranges and Countifs function
I have a metric sheet that I am trying to pull data from another sheet.
I am trying to get counts by person that fall:
within 3 months
within 3-6 months
within 6-9 months
within 9-12 months
within 12 months.
I have done a few searches within the community, but I cannot wrap my head around this. Any thoughts?
Best Answer
-
Give these a go…
within 3 months:
=COUNTIFS({Date Range}, AND(@cell >= TODAY(), @cell <= IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 3, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 9, DAY(TODAY())))))
within 3-6 months:
=COUNTIFS({Date Range}, AND(@cell > IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 3, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 9, DAY(TODAY()))), @cell <= IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 6, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 6, DAY(TODAY())))))
within 6-9 months:
=COUNTIFS({Date Range}, AND(@cell > IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 6, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 6, DAY(TODAY()))), @cell <= IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 9, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 3, DAY(TODAY())))))
within 9-12 months:
=COUNTIFS({Date Range}, AND(@cell > IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 9, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 3, DAY(TODAY()))), @cell <= DATE(YEAR(TODAY()) + 1, MONT(TODAY()), DAY(TODAY()))
within 12 months:
=COUNTIFS({Date Range}, AND(@cell >= TODAY(), @cell <= DATE(YEAR(TODAY()) + 1, MONTH(TODAY()), DAY(TODAY()))))
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Answers
-
Am I correct in assuming that you mean within # months of today's date?
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
Paul, yeah, # of months from today's date.
-
Give these a go…
within 3 months:
=COUNTIFS({Date Range}, AND(@cell >= TODAY(), @cell <= IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 3, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 9, DAY(TODAY())))))
within 3-6 months:
=COUNTIFS({Date Range}, AND(@cell > IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 3, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 9, DAY(TODAY()))), @cell <= IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 6, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 6, DAY(TODAY())))))
within 6-9 months:
=COUNTIFS({Date Range}, AND(@cell > IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 6, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 6, DAY(TODAY()))), @cell <= IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 9, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 3, DAY(TODAY())))))
within 9-12 months:
=COUNTIFS({Date Range}, AND(@cell > IFERROR(DATE(YEAR(TODAY()), MONTH(TODAY()) + 9, DAY(TODAY())), DATE(YEAR(TODAY()) + 1, MONTH(TODAY()) - 3, DAY(TODAY()))), @cell <= DATE(YEAR(TODAY()) + 1, MONT(TODAY()), DAY(TODAY()))
within 12 months:
=COUNTIFS({Date Range}, AND(@cell >= TODAY(), @cell <= DATE(YEAR(TODAY()) + 1, MONTH(TODAY()), DAY(TODAY()))))
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
THANK YOU!!! THANK YOU!!! THANK YOU!!!
These worked like a charm. Note to anyone else who uses this - the 9-12 section is missing an "H" in Month!
-
Happy to help. 👍️
Sorry about missing that H. It happened quite a few times when typing those out, but I seem to have missed that one. I think it may be time for a new keyboard. Haha.
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.8K Get Help
- 376 Global Discussions
- 207 Industry Talk
- 440 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 284 Events
- 33 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!