How can I create COUNTIF for current week in current year
I am looking to count how many dates fall within the current week of the current year in crossed sheets
This the formula I am trying to use , but it does not work
=COUNTIFS({Deviation Management - Veeva [Archive] Range 3}; AND(IFERROR(WEEKNUMBER(@cell); 0) = WEEKNUMBER(TODAY()); IFERROR(YEAR(@cell); 0) = YEAR(TODAY())))
Answers
-
@Ilana Trahtenberg I think it's the IFERRORs that are throwing things off. Hard to tell for sure without knowing what error message you're getting.
We can remove the IFERRORs and instead replace them with a criteria that verifies the cell is a date value before proceeding with the rest of the formula:
=COUNTIFS({Deviation Management - Veeva [Archive] Range 3}; AND(ISDATE(@cell); WEEKNUMBER(@cell) = WEEKNUMBER(TODAY()); YEAR(@cell) = YEAR(TODAY()))
Why will this work? COUNTIFS works from left to right, so the first thing it will do is look for cells that are date values and disregard the rest. Then from that subset of cells that are dates, it evaluates for the weeknumber and year values - and it won't error on either of those because it's only evaluating cells that have dates in them.
Regards,
Jeff Reisman
Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages
If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!
-
Thank you!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 437 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!