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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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,226,113
Messages
6,189,046
Members
453,522
Latest member
Seeker2025

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