COUNTIFS with dates
Hi all,
I'm struggling to get a formula to work that can return the number of projects that start within the next 4 weeks. In the main sheet we have a project type column and a project start date column. In the following formula Smartsheet range 1 is the project type and Smartsheet rage 2 is the start date:
=COUNTIFS({Smartsheet Range 1}, "Project type 1", {Smartsheet Range 2}, <=DATE+28)
I have also tried:
=COUNTIFS({Smartsheet Range 1}, "Project type 1", {Smartsheet Range 2}, <=(DATE+28))
I can get it to work with a set date:
=COUNTIFS({Smartsheet Range 1}, "Project type 1", {Smartsheet Range 2}, <=(DATE(2025, 3, 30)))
but I want this to work out the live number of projects so I can add a graph in a dashboard that will constantly update, so need the date to be the current date moving forwards. The above formula will only give a snapshot on that particular date.
Any help would be much appreciated.
Cheers,
Kirk
Best Answer
-
Instead of DATE, use the TODAY function for today's date
TODAY(28) will return today's date plus 28 days.
=COUNTIFS({Smartsheet Range 1}, "Project type 1", {Smartsheet Range 2}, <=(TODAY(28)))
For bonus points, I noticed that your formula will include all projects of the correct type that start before or on the date 4 weeks from today which will include those starting before today. If you only want those starting within the next 4 weeks you will need to add another criteria to the COUNTIFS to only include those that start today or later. That would look like this:
=COUNTIFS({Smartsheet Range 1}, "Project type 1", {Smartsheet Range 2}, <=(TODAY(28)),{Smartsheet Range 2},>=TODAY())
Hope this helps.
Answers
-
Instead of DATE, use the TODAY function for today's date
TODAY(28) will return today's date plus 28 days.
=COUNTIFS({Smartsheet Range 1}, "Project type 1", {Smartsheet Range 2}, <=(TODAY(28)))
For bonus points, I noticed that your formula will include all projects of the correct type that start before or on the date 4 weeks from today which will include those starting before today. If you only want those starting within the next 4 weeks you will need to add another criteria to the COUNTIFS to only include those that start today or later. That would look like this:
=COUNTIFS({Smartsheet Range 1}, "Project type 1", {Smartsheet Range 2}, <=(TODAY(28)),{Smartsheet Range 2},>=TODAY())
Hope this helps.
-
Hi KPH,
That's brilliant, thank you so much for the answer and brilliant solution! Love the addition of the third criteria and will definitely be using it :)
-
Glad I could help! Thanks for the feedback.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 66.7K Get Help
- 436 Global Discussions
- 152 Industry Talk
- 497 Announcements
- 5.3K Ideas & Feature Requests
- 85 Brandfolder
- 155 Just for fun
- 77 Community Job Board
- 508 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!