extracting week number and year from date

Julia_P

New Member
Joined
Feb 18, 2016
Messages
7
Hi all,

I need help with extracting the week number and year from a certain date in excel and I don't get the correct information when a week contains different years. I am using this formula:

=CONCATENATE(YEAR(A2)," ",TEXT(WEEKNUM(A2,21),"00"))

and I get these results:
12/31/2015: 2015 53


1/1/2016: 2016 53

The result for 1/1/2016 should be 2015 53 as week 1 2016 starts on 1/4/2016 as per the European system.

Can somebody help me how to get the correct result?

Thanks!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Now I get for 1/1/2016: 2016 1. Firstly, in the European system, the first week of the year needs to include at least 4 days of January, which means that 1/1/2016 should be considered in the last week of 2015 and not in the first week of 2016. Secondly, I need the week to have two digits (so 01 instead of 1)
 
Upvote 0
Now I get for 1/1/2016: 2016 1. Firstly, in the European system, the first week of the year needs to include at least 4 days of January, which means that 1/1/2016 should be considered in the last week of 2015 and not in the first week of 2016. Secondly, I need the week to have two digits (so 01 instead of 1)

If you are on Excel 2013 or beyond...

=YEAR(A2)&" "&TEXT(ISOWEEKNUM(A2),"00")
 
Upvote 0
It still results year 2016:
12/31/2015 2015 53
1/1/2016 2016 53

These two days are in the same week and I need it to show the same year and week number, respectively 2015 53
 
Upvote 0
It still results year 2016:
12/31/2015 2015 53
1/1/2016 2016 53

These two days are in the same week and I need it to show the same year and week number, respectively 2015 53

Here is a tweak:

=YEAR(A2)-(ISOWEEKNUM(A2)<>WEEKNUM(A2,2))&" "&TEXT(ISOWEEKNUM(A2),"00")

Hope it survives further scrutiny...
 
Upvote 0
It fixes the week 53 2015 but what should be week 1 2016 results in 2015 01:

1/3/2016 2015 53
1/4/2016 2015 01
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,424
Members
448,961
Latest member
nzskater

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