I need the WEEKNUM command to display 2 digits for the week

lazzareo

New Member
Joined
Oct 13, 2009
Messages
28
I have a sheet of data and in 'column Q' I have the following command in each cell (example below for cell Q2):

=WEEKNUM(O2) & TEXT(O2, "-yy")

This displays the week and year of the date in 'column O' i.e. 2-19 or 32-18 etc

I then have a pivot that reports on the number of tickets created by week which looks good but as my data spans 2018 & 2019 it displays the week as a single number for weeks 1-9. This is therefore displaying the weeks out of order rather than chronologically. e.g 20-18, 21-18, 2-18, 2-19, 22-18, 23-18 and so on...

If I could get the WEEKNUM command to include two digits for each week then this would solve the problem because in the scenario above 2-18 would become 02-18 and appear near the start.

Would anyone be able able to suggest anything to resolve this.

Thanks.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Just use the TEXT function, like you are already doing for the second part of your formula, i.e.
=TEXT(WEEKNUM(O2),"00") & TEXT(O2, "-yy")
 
Upvote 0
try this

=TEXT(WEEKNUM(O2),"00") & TEXT(O2, "-yy")
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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