WeekNum function following a 53 week year

JamesCollins

New Member
Joined
Jan 4, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi I'm looking for some help with the Weeknum function please.
Our work calendar runs Sunday-Saturday, with week 1 this year being Sunday Jan 7th (the first Sunday of January). However Weeknum uses the Week 1 as the first week of January containing a Monday, which is our week 53 for last year.

Many thanks,
James
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
It seems correct the result you are getting from Weeknum.
The week starting 31-dic-2023 is the number 53 of the year 2023 and is the number 1 of the year 2024.
By the way most years have the week number 53, and some even 54, like in the year 2000, 2028, 2056 for example.
What do you want to achieve? Do you need the week number to be used in another formula? Could you explain in more detail your problem?

23/12/2023 Sat51
24/12/2023 Sun52
25/12/2023 Mon52
26/12/2023 Tue52
27/12/2023 Wed52
28/12/2023 Thu52
29/12/2023 Fri52
30/12/2023 Sat52
202331/12/2023 Sun53
202401/01/2024 Mon1
02/01/2024 Tue1
03/01/2024 Wed1
04/01/2024 Thu1
05/01/2024 Fri1
06/01/2024 Sat1
07/01/2024 Sun2
08/01/2024 Mon2
09/01/2024 Tue2
10/01/2024 Wed2
11/01/2024 Thu2
12/01/2024 Fri2
13/01/2024 Sat2
14/01/2024 Sun3
15/01/2024 Mon3
16/01/2024 Tue3
17/01/2024 Wed3
18/01/2024 Thu3
19/01/2024 Fri3
20/01/2024 Sat3
 
Upvote 0
Hi felixstraube
I need Sunday 31/12/23 to Saturday 6/1/24 to be week 53
Then Week 1 to be Sunday 7/1/24 to Sat 13/1/24 and so on.
1704386144290.png
 
Upvote 0
If you have your date in B2 try this formula:

Excel Formula:
=LET(d,B2,
maxWeekNumberOfLastYear_temp,WEEKNUM(DATE(YEAR(d)-1,12,31)),
currentWeekNumber,WEEKNUM(d),
firstDayOfYearIsSunday,WEEKDAY(DATE(YEAR(d),1,1))=1,
firstDayOfLastYearIsSunday,WEEKDAY(DATE(YEAR(d)-1,1,1))=1,
correctedMaxWeekNumberOfLastYear,IF(firstDayOfLastYearIsSunday,maxWeekNumberOfLastYear_temp,maxWeekNumberOfLastYear_temp-1),
IF(firstDayOfYearIsSunday,currentWeekNumber,IF(currentWeekNumber=1,correctedMaxWeekNumberOfLastYear,currentWeekNumber-1))
)

I checked if it works ok for the next years:

1704393682185.png




In the file there is a complete list of year till 2046.

WeekNumber.zip


Another thing you could do is just convert the last week to 1 if it is not a complete week like this (also in the file):

1704395343704.png


The formula for that would be:
Excel Formula:
=LET(d,B2,
maxWeekNumberOfYear_temp,WEEKNUM(DATE(YEAR(d),12,31)),
currentWeekNumber,WEEKNUM(d),
lastDayOfYearIsSaturday,WEEKDAY(DATE(YEAR(d),12,31))=7,
IF(NOT(lastDayOfYearIsSaturday)*(currentWeekNumber=maxWeekNumberOfYear_temp),1,currentWeekNumber)
)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top