Be very careful with weeknumbers -they are not the same in Europe and in US.
See http://www.cpearson.com/excel/weeknum.htm
on this.
.... assuming you're in the eurpoean branch of Ericsson..
You can use a UDF, but the result will be text and not a number that can be
used in other calculations.
===============
Function yw(dt As Date) As String
yw = Format(dt, "yyyy-ww")
End Function
==============
The VBA Format function has some optional arguments to define both the first
day of the week, and the first week of the year. You should check these out to
see which applies to your requirements.
I believe the following would conform to the ISO weeknumber convention:
=================
Function yw(dt As Date) As String
yw = Format(dt, "yyyy-ww", vbMonday, vbFirstFourDays)
End Function
================
--ron
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.