Change Date to show Year & Week of the Year

bobgrand

Board Regular
Joined
Apr 14, 2008
Messages
244
Office Version
  1. 365
Platform
  1. Windows
Hello all, I hope we are all being safe these days.

I am trying to create a formula to change the date 2/14/2020 to be a Year & Week of the year format.

Examples
DATE ------- Converted to YYWK
2/14/2020 = 2007
2/21/2020 = 2008
2/28/2020 = 2009
3/6/2020 = 2010
3/13/2020 = 2011

Any help would be greatly appreciated.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
How about
=(TEXT(A2,"yy")&TEXT(ISOWEEKNUM(A2),"00"))+0
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
For those of you, like me, who do not have the ISOWEEKNUM function available to them, I believe (if I have encoded it correctly) that this formula will produce the same results as Fluff's formula... of course I cannot test that, so if someone with that function available will runs some tests, that would be appreciated.

=INT(MOD(MOD(28*MOD((INT(A2+692501)/7),20871)+4383,146096),1461)/28)+1
 
Upvote 0
For those of you, like me, who do not have the ISOWEEKNUM function available to them, I believe (if I have encoded it correctly) that this formula will produce the same results as Fluff's formula... of course I cannot test that, so if someone with that function available will runs some tests, that would be appreciated.

=INT(MOD(MOD(28*MOD((INT(A2+692501)/7),20871)+4383,146096),1461)/28)+1
Doesn't appear to be the same

1594924984067.png
 
Upvote 0
Hello Rick
That gives a weeknumber of 2 for 5th Jan 2020, whereas the ISO weeknum is 1
 
Upvote 0
There are also some "Funnies" like next year
+Fluff New.xlsm
ABC
1ISORick
201/01/201911
302/01/201911
403/01/201911
504/01/201911
605/01/201912
706/01/201912
807/01/201922
901/01/202011
1002/01/202011
1103/01/202011
1204/01/202011
1305/01/202012
1406/01/202022
1507/01/202022
1601/01/2021531
1702/01/2021531
1803/01/2021531
1904/01/202111
2005/01/202112
2106/01/202112
2207/01/202112
2308/01/202112
2409/01/202112
2510/01/202112
2611/01/202122
Result
Cell Formulas
RangeFormula
B2:B26B2=ISOWEEKNUM(A2)
C2:C26C2=INT(MOD(MOD(28*MOD((INT(A2+692501)/7),20871)+4383,146096),1461)/28)+1
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,668
Members
449,463
Latest member
Jojomen56

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