How you calculate the difference for the weeknumber of a date and todays date, considering the year?
I have a project schedule where we use
=IFERROR(WEEKNUMBER([End Date]@row) - WEEKNUMBER(TODAY()), "")
to calculate how far away the week number of the End Date is from the week number of Today's date. We have End Date's that are from Today's date just a year ago causing them to calculate a 0 as if the row item's End Date was this week. Is there anyway I can alter the formula to consider only this years End Date?
Best Answers
-
Just add in an IF statement qualifying the year.
=IF(YEAR([End Date]@row)=YEAR(TODAY()), (IFERROR(WEEKNUMBER([End Date]@row) - WEEKNUMBER(TODAY()), "")),"Wrong Year")
EDIT:
Just simplified it a bit
=IFERROR(WEEKNUMBER([Due Date]@row) - WEEKNUMBER(TODAY()), "") + 52 * ((YEAR(TODAY()) - YEAR([Due Date]@row)))
This will calculate regardless of the year. Hope this works better!
-
@mwb I updated my solution to you, hope you see it, if not here is a better formula.
=IFERROR(WEEKNUMBER([Due Date]@row) - WEEKNUMBER(TODAY()), "") + 52 * ((YEAR(TODAY()) - YEAR([Due Date]@row)))
Answers
-
Just add in an IF statement qualifying the year.
=IF(YEAR([End Date]@row)=YEAR(TODAY()), (IFERROR(WEEKNUMBER([End Date]@row) - WEEKNUMBER(TODAY()), "")),"Wrong Year")
EDIT:
Just simplified it a bit
=IFERROR(WEEKNUMBER([Due Date]@row) - WEEKNUMBER(TODAY()), "") + 52 * ((YEAR(TODAY()) - YEAR([Due Date]@row)))
This will calculate regardless of the year. Hope this works better!
-
That worked thank you!
-
@mwb I updated my solution to you, hope you see it, if not here is a better formula.
=IFERROR(WEEKNUMBER([Due Date]@row) - WEEKNUMBER(TODAY()), "") + 52 * ((YEAR(TODAY()) - YEAR([Due Date]@row)))
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 63.9K Get Help
- 410 Global Discussions
- 219 Industry Talk
- 457 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 136 Just for fun
- 57 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 298 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!