+ Reply to Thread
Results 1 to 5 of 5

Extract startdate and enddata based on week number

  1. #1
    Registered User
    Join Date
    02-28-2004
    Location
    Oslo, Norway
    Posts
    14

    Extract startdate and enddata based on week number

    Hello!
    I want to make a code that allows the user to enter week number (and year), the code should then generate the start- and enddate of this week.
    (it's the functions, not the dialogboxes I'm looking for).

    Thx in advance!

  2. #2
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,676
    How are your week numbers defined, are they ISO week numbers?

  3. #3
    Registered User
    Join Date
    02-28-2004
    Location
    Oslo, Norway
    Posts
    14
    Quote Originally Posted by daddylonglegs
    How are your week numbers defined, are they ISO week numbers?
    No, just weeknumber (e.g. 41 this week) and year. That should be sufficient to determine startdate (monday Oct. 8) and enddate (sunday Oct. 14)...? (It's sure is, if you have an old almanac... )

  4. #4
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,676
    OK, I ask because Excel has a WEEKNUM function which gives different results to the standard ISO week numbers used in Europe. With ISO week numbers week 1 starts on the first Monday on or after 29th December.

    Sorry, you probably want VBA but you can get the start date with a formula like this

    =DATE(B1,1,A1*7-2)-WEEKDAY(DATE(B1,1,3))

    where B1 contains the year and A1 the week number

    to get the end date just add 6 to the start date

  5. #5
    Registered User
    Join Date
    02-28-2004
    Location
    Oslo, Norway
    Posts
    14
    Thank You very much, daddylonglegs! Your solution works perfect!

    Best regards
    Georg Rokne
    Last edited by gerok; 10-09-2007 at 02:13 AM. Reason: spelling

+ 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