+ Reply to Thread
Results 1 to 6 of 6

Finding date from weeknumber

  1. #1
    Registered User
    Join Date
    07-07-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    3

    Finding date from weeknumber

    Hi,

    I need to find the date, preferably of the sunday, in a given week.
    For example, I have as input week 27 2008, I'd like to find the date of the sunday in that week.

    I'm actually trying to find the number of weeks between two such sets of input, for example week 27, 2008 to week 12, 2010.
    I figured if I could find the dates, I could simply use

    difference=int(date2-date1)/7

    but if anyone has a better idea, let me know.


    A

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,038

    Re: Finding date from weeknumber

    I think that formula will return you an mistake...

    For example 19.7.1010 - 1.2.2010 will give you 2 weeks while there's 3 weeke difference...

    This maybe:

    =WEEKNUM(date1, 1)-WEEKNUM(date2, 1)
    Never use Merged Cells in Excel

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,038

    Re: Finding date from weeknumber

    Important:

    The WEEKNUM function considers the week containing January 1 to be the first week of the year. However, there is a European standard that defines the first week as the one with the majority of days (four or more) falling in the new year. This means that for years in which there are three days or less in the first week of January, the WEEKNUM function returns week numbers that are incorrect according to the European standard.

  4. #4
    Registered User
    Join Date
    07-07-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Finding date from weeknumber

    But as long as I'm consistent throughout the macro, for example by specifying that a week always begins on a monday, I should be able to work around that problem with WEEKNUM.

    Still, I need to find the date first..
    Any suggestions on that problem?

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,038

    Re: Finding date from weeknumber

    IS sunday first or last day of the week?

    This maybe: ="27.12.2009"+(E3-1)*7

    (where 27.12.2009 is last sunday of year before).

  6. #6
    Registered User
    Join Date
    07-07-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Finding date from weeknumber

    Sunday would be the last day of the week.
    This macro must be flexible and able to work over several years, so I don't know the last sunday of the previous year.
    If each year had 52 weeks, this would have been easy, but some years have 53 weeks and I don't know if there is a simple way of finding out which ones they are.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1