How to display weeknumber with year code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can display weeknumber but I need in front year code in 2 cifers.
Does anyone knows easy solution?
 
=TEXT(A1,"yy")&TEXT(weeknum(A1),"00")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
I can display weeknumber but I need in front year code in 2 cifers.
Does anyone knows easy solution?

=TEXT(date,"yy")&TEXT(weeknum(date),"00")

will display a two digit year followed by a two digit weeknumber.

Note that the Excel Weeknum function uses "Excel's definition" of weeknumber
which is not the ISO standard. If you want to use the ISO standard weeknumber,
you'll need a VBA User Defined Function or a complicate worksheet function.

The VBA code for ISO weeknum:

--------------------
Function ISOWeeknum(dt As Date) As Integer
ISOWeeknum = DatePart("ww", dt, vbMonday, vbFirstFourDays)
If ISOWeeknum > 52 Then
If DatePart("ww", dt + 7, vbMonday, vbFirstFourDays) = 2 Then
ISOWeeknum = 1
End If
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top