Week Number and Year from Date

tandkb

New Member
Joined
Dec 29, 2010
Messages
47
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am needing Week Number and Year from the date. I have been using this formula. =TEXT(WEEKNUM(AH2,21),"00") & TEXT(AH2, "-yyyy") and it works quite well. Our Weeks run Monday Through Sunday. The problem I am having is when I get to that date 12/30/19 the Week is 1 which is correct but the year is 2019 which is not correct. The week ends on 1/5/2020 so it should be Week 1 2020 not Week 1 2019. Anyone have any ideas on this? I know this has been talked about a ton but cant find any exact fix for this senario. Thanks in advance!
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,694
Office Version
  1. 365
Platform
  1. Windows
One way is
Excel Formula:
=TEXT(WEEKNUM(AH2,21),"00")&TEXT(AH2, "-yyyy")-(AND(MONTH(AH2)=12,WEEKNUM(AH2,21)=1))
Also please update your account details to show your version of Excel, as this affects which functions you can use.
 

tandkb

New Member
Joined
Dec 29, 2010
Messages
47
Office Version
  1. 365
Platform
  1. Windows
One way is
Excel Formula:
=TEXT(WEEKNUM(AH2,21),"00")&TEXT(AH2, "-yyyy")-(AND(MONTH(AH2)=12,WEEKNUM(AH2,21)=1))
Also please update your account details to show your version of Excel, as this affects which functions you can use.
This worked perfectly! Thanks so much!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,694
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,935
Messages
5,627,705
Members
416,268
Latest member
zRGZgDNnmaPhepwviEou

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
Top