WEEKNUMBER returning incorrect value?
[Please note dates are in YYYY-MM-DD format as I am in Australia and date column name is TueDate]
-- Ignore last column they are calculated values that I needed to keep in the image so you could see the formula
I have the following sheet, which uses the WEEKNUMBER function to just return the number of the week in the year. The second column uses YEAR([email protected]) to return the year.
I am looking at every Tuesday and what week number that is. As it turns out 1/1/2019 is also a Tuesday and that correctly returned WEEKNUMBER=1 for 2019, but for Dec 31, 2019 it also returns WEEKNUMBER=1 for 2019.
At the end of 2020 it (correctly?) returns WEEKNUMBER=53 for Dec 29, 2020
Is this a bug in SmartSheet, Dec 31, 2019 cannot be week 1 for 2019?
Are there any suggested work arounds other than manually changing the values for Dec 31, 2019 and adjusting the following formulas by one?
✅Did my post help answer your question or solve your problem? Please help the Community bymarking it as the accepted answer/helpful. It will make it easier for others to find a solution or help to answer!
Answers
-
Alejandra Employee
Hi Frank,
Smartsheet calculates week numbers based on Mondays. Due to this, the first day of the year may not be in the first week of the year. For example, if January 1st is a Monday, WEEKNUMBER returns 1, however if it’s a Friday, WEEKNUMBER returns 52.
When you have a moment, please submit aProduct Enhancement Requestto let our Product team know that you'd like to have this function work differently in Smartsheet.
-
Frank Falco ✭✭✭✭✭✭
Thanks for clarifying the day of the week it is calculated on.
I do not think it is the issue of calculation being a based on a Monday.
Dec 30, 2019 is also returning week 1 or 2019, it should be week 53 just as Dec 29, 2020 does.
This is causing some real issues as there are now two weeks in 2019 in week number 1, which is giving me incorrect totals in my weekly calculations.
I'm not sure what the correct solution is here, but it is a interesting edge case.
I will have to come up with another way of doing my calculations.
For interest, here is what is returned for the date ranges around the first day of the year:
2019-2020
51 2019 2019-12-22
522019 2019-12-23
52 2019 2019-12-24
52 2019 2019-12-25
522019 2019-12-26
522019 2019-12-27
522019 2019-12-28
522019 2019-12-29
1 2019 2019-12-30
1 2019 2019-12-31 - 1st week of 2019?
1 2020 2020-01-01 - 1st week of 2020
1 2020 2020-01-02
1 2020 2020-01-03
1 2020 2020-01-04
1 2020 2020-01-05
2020-2021
522020 2020-12-22
522020 2020-12-23
522020 2020-12-24
522020 2020-12-25
522020 2020-12-26
522020 2020-12-27
53 2020 2020-12-28
53 2020 2020-12-29
53 2020 2020-12-30
53 2020 2020-12-31 - 53rd week of 2020
53 2021 2021-01-01 - 53rd week of 2021?
53 2021 2021-01-02
53 2021 2021-01-03
1 2021 2021-01-04
1 2021 2021-01-05
✅Did my post help answer your question or solve your problem? Please help the Community bymarking it as the accepted answer/helpful. It will make it easier for others to find a solution or help to answer!
-
Earl Tessmer ✭✭✭✭
Hello
I have run into the same problem. I understand that the function calculates based upon the Monday of the week.
I am working in October - December 2020.
However, there are some weeks it returns week number +1. In weeks before October it seems to return the correct week number. And in the last week of December it returns 53. Which should never be so according to the function spec.
I am interested in the fix please.
Help Article Resources
Categories
Try this:<\/p>
=IF(ISDATE([Event Date]@row), IF(AND([Event Date]@row > TODAY(), [Event Date]@row <= TODAY(30)), \"Less than 30 days from today\", \"More than 30 days from today\"), \"//www.santa-greenland.com/community/discussion/65046/\")<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":108267,"type":"question","name":"Combining IF Formula for Blank\/ Not Blank Cells","excerpt":"I want to create a formula that provides the below statuses: -Complete: Based on \"Collected Date\" not null -Incomplete: Based on \"Collected Date\" null and \"Antcipated Collected Date\" null -Pending: Based on \"Anticipated Collcted Date\" not null and \"Collected Date\" null Below is what I have, but it's unparseable:…","snippet":"I want to create a formula that provides the below statuses: -Complete: Based on \"Collected Date\" not null -Incomplete: Based on \"Collected Date\" null and \"Antcipated Collected…","categoryID":322,"dateInserted":"2023-07-28T17:23:40+00:00","dateUpdated":null,"dateLastComment":"2023-07-28T18:28:47+00:00","insertUserID":164288,"insertUser":{"userID":164288,"name":"brownrobe","url":"https:\/\/community.smartsheet.com\/profile\/brownrobe","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-28T18:42:06+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":164288,"lastUser":{"userID":164288,"name":"brownrobe","url":"https:\/\/community.smartsheet.com\/profile\/brownrobe","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-28T18:42:06+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":36,"score":null,"hot":3381135147,"url":"https:\/\/community.smartsheet.com\/discussion\/108267\/combining-if-formula-for-blank-not-blank-cells","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108267\/combining-if-formula-for-blank-not-blank-cells","format":"Rich","lastPost":{"discussionID":108267,"commentID":387885,"name":"Re: Combining IF Formula for Blank\/ Not Blank Cells","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/387885#Comment_387885","dateInserted":"2023-07-28T18:28:47+00:00","insertUserID":164288,"insertUser":{"userID":164288,"name":"brownrobe","url":"https:\/\/community.smartsheet.com\/profile\/brownrobe","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-28T18:42:06+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-07-28T18:30:11+00:00","dateAnswered":"2023-07-28T18:22:11+00:00","acceptedAnswers":[{"commentID":387882,"body":"