+ Reply to Thread
Results 1 to 9 of 9

Create Date to be Week 1

  1. #1
    Registered User
    Join Date
    07-12-2011
    Location
    Kildare,Ireland
    MS-Off Ver
    Excel 2010
    Posts
    59

    Create Date to be Week 1

    Hi
    Is there a formula that I can use to set Week 1 to be 04/05/2014? I know how to change it from a certain day in the week to another, but not to set a specific date to be Week 1 and so on.

    Thanks in advance.

    Dave

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Create Date to be Week 1

    Hi, assuming that your dates start in A1, use this:

    =WEEKNUM(DATE(YEAR(A1),MONTH(A1),DAY(A1)))-18
    Last edited by Glenn Kennedy; 09-15-2014 at 07:53 AM. Reason: Silly mistake...
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Create Date to be Week 1

    @Glenn Kennedy

    That was my first thought but surely that wont work.

    01/01/2015 produces a WEEKNUM of -17.

    You need to cater for when the week numbers exceed 33 which will be end of 2014.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Create Date to be Week 1

    Indeed, you're quite right. try this, instead:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Create Date to be Week 1

    Quote Originally Posted by Dave350z View Post
    Is there a formula that I can use to set Week 1 to be 04/05/2014?
    Hello Dave,

    I assume that you need to reset to week 1 each year. Is there a more general rule that would apply to any year, e.g. week 1 starts on the first Sunday in May?
    Audere est facere

  6. #6
    Registered User
    Join Date
    07-12-2011
    Location
    Kildare,Ireland
    MS-Off Ver
    Excel 2010
    Posts
    59

    Re: Create Date to be Week 1

    General weekly rule is that it's Sunday to Saturday is the week.

    The week 1 rule is going to be determined most likely by the first Sunday to Saturday full week 1 year later. So in 2015 - 03/05/2015 will be week 1.


    By the way - the if formula above doesn't work, I get #NUM error the week before the 04/05/2014 and FALSE on the 04/05/2014 and thereafter.

    Ideally I need to be able to drag the formula back as well, so week 52 will be the week before and so on.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Create Date to be Week 1

    OK, with a any date in A2 this formula will give you the week number assuming that week 1 starts every year on the Sunday in the range 1st - 7th May

    =INT((A2-WEEKDAY(A2)-DATE(YEAR(A2+246-WEEKDAY(A2))-1,5,7))/7)+2

    As per ISO week numbers that means some years (roughly 1 in six) will have 53 weeks, others will have 52

  8. #8
    Registered User
    Join Date
    07-12-2011
    Location
    Kildare,Ireland
    MS-Off Ver
    Excel 2010
    Posts
    59

    Re: Create Date to be Week 1

    Great, that'll work!

    I assume there's no way around the 53 week issue?

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Create Date to be Week 1

    Most week numbering systems will give you a week 53 because, obviously 365/366 days is 1/2 days more then 52 weeks, so 2016 will start on Sunday 1st May but the next year starts on Sunday 7th May so the last week of 2016/2017 will be 53.

    If you never go higher than 52 then you can only do that by having the year start getting earlier each year......or some weeks having more than 7 days. This version won't go higher than 52 but it means that some years week 52 is 14 days long!

    =MOD(INT((A2-WEEKDAY(A2)-DATE(YEAR(A2+246-WEEKDAY(A2))-1,5,7))/7)+1,52)+1

    Note that WEEKNUM can even return 54!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 03-19-2014, 05:07 AM
  2. Replies: 6
    Last Post: 10-19-2012, 04:55 PM
  3. Create a week begining calender with custom week number
    By rds2472 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2009, 05:02 AM
  4. Create Function To Change Date into Week Number
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-31-2008, 10:10 AM
  5. Create date value from week no.
    By nsv in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-07-2007, 08:49 AM

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