weeknumbers 2020/2021 in Numbers

Weeknumber of 31-12-2020 gives me 53

Weeknumber 01-01-2021 gives me 1

Both dates are in the same week and should have the same weeknumber


MacBook, macOS 10.14

Posted on Nov 10, 2020 7:44 AM

Reply
4 replies

Nov 10, 2020 9:26 AM in response to pjdewit

I just spent 30 minutes looking at the various date systems and how they do week numbers. Under none of them that I found is a week anything but 7 days. The algorithm here always makes Jan 1 start week 1, which would be okay in the Northern American system except that the days in December that start that week should also be week 1 (which they are not) and there should be 7 days to all weeks (which there are not). I'd say this function is broken. You can put in a bug report using the menu Numbers/Provide Numbers Feedback.


I'm going to wait to see if anyone else comes up with something that explains it as anything but a bug. I suppose it could be a function that does not mean what we think it means. We expect it to be following a standard but nowhere in the description of the function does it mention a standard.


EDIT: Stupid me, this is an Excel thing. It is a function compatible with Excel's function of the same name and gives the same results. So there you go. Not a bug, just a function that does not do what we thought it should do. Excel's version does, however, let you specify first day as Monday AND using the ISO system. Numbers does not allow that same thing.


Nov 19, 2020 3:21 AM in response to pjdewit

Excel has an ISOWEEKNUM function that does what you want.


Numbers doesn't have that function. But you can calculate the equivalent of the Excel function with this long formula:




The formula in C2, filled or copied down the column, is:


=INT((STRIPDURATION(A2−DATE(YEAR(A2−WEEKDAY(A2−1)+4),1,3))+WEEKDAY(DATE(YEAR(A2−WEEKDAY(A2−1)+4),1,3))+5)/7)


Be sure to include the final ) which seems to be cut off by the forum software.


Here it is again (it scrolls left so you can see and select the whole thing for copy-pasting).


INT((STRIPDURATION(A2−DATE(YEAR(A2−WEEKDAY(A2−1)+4),1,3))+WEEKDAY(DATE(YEAR(A2−WEEKDAY(A2−1)+4),1,3))+5)÷7)


If your region uses , as a decimal separator be sure to substitute ; for , in the formula.


If your Numbers is not normally set to English you could start a new document, switch to English via File > Advanced > Language & Region ... then copy/paste the formula from this post into your table, adds dates in a column to make sure the formula is working, then switch back to your language via File > Advanced > Language & Region. Numbers will automatically convert the formula to what you need to use in your language/region.


SG



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

weeknumbers 2020/2021 in Numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.