+ Reply to Thread
Results 1 to 9 of 9

Week number calculation problem

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Week number calculation problem

    I need a formula for excel 2007 to calculate the week number if the week starts on a Saturday, I noticed that the Weeknum(A1,16) is not working for 2007

    When I use Weeknum(A1,1) I get week 18 for 04/05/2013 and I need week 19

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Week number calculation problem

    hi and welcome to the forum Hoe gaan dit?

    1st, there is no weeknum(a1,16)...weeknum() takes a 1 or 2

    1...Week begins on Sunday. Weekdays are numbered 1 through 7.
    2...Week begins on Monday. Weekdays are numbered 1 through 7.

    I get 18 too, if you want to "fix" it, add 1
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    01-22-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Week number calculation problem

    Thanks Fdibbins,

    I've been using this forum for quite some time know, just never had to ask anything before.

    If I add 1 my week starts on 05/05/2013 as week 20 and I need my week to start as week 19 on 04/05/2013

    If this date :A1=04/05/2013 then the weeknumber should be B1=19
    A2=11/05/2013 B2=20
    A3=18/05/2013 B3=21
    A4=25/05/2013 B4=22

    Hope this explains it a little better

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Week number calculation problem

    I have checked 3 different web sites, and they all confirm that 4/5 (Euro/SA date format) is week 19, not week 20. So if you want something other than that, use weeknum()+1

    http://www.calendar-365.com/week-number.html
    http://www.epochconverter.com/date-a...rs-by-year.php
    http://weeknumber.net/calendar/england/2013-1

  5. #5
    Registered User
    Join Date
    01-22-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Week number calculation problem

    I ended up using this formula:

    =WEEKNUM(A1,WEEKDAY(A1,1)-6)+1

    It works great, just need to workout how Week 53 need to show as Week 1

    week numbers.xls

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

    Re: Week number calculation problem

    Quote Originally Posted by jacodtt View Post
    =WEEKNUM(A1,WEEKDAY(A1,1)-6)+1
    If you are using Excel 2007 that will given an error if A1 is any day but Saturday so you might as well use FDibbins suggestion and use

    =WEEKNUM(A1)+1

    which will always give the same results for Saturdays.

    There are usually 2 elements which fully define how you want week numbers to work - start day (which in your case is Saturday) and definition of week 1 (WEEKNUM always starts week 1 on 1st Jan but next week starts on the first Sunday/Monday after that whereas ISO week numbers always have 7 days with week 1 possibly starting at the end of the previous year) - what's your definition?

    This formula will give you results equivalent to =WEEKNUM(A1,16)......without using Excel 2010

    =INT((A1-DATE(YEAR(A1),1,1)-WEEKDAY(A1+1))/7)+2

    but that formula will give you 53s too (and even 54 in some years, e.g. 2016)
    Audere est facere

  7. #7
    Registered User
    Join Date
    01-22-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Week number calculation problem

    Thanks Daddylonglegs,

    Unfortunately the company I work for has the week starting on a Saturday and doing projects its difficult stating the progress if the week number is not correct.

    I will use this formula and just change Week 53 to Week 1.

    Thanks

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Week number calculation problem

    You try this

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-22-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Week number calculation problem

    This formula is working great,

    thank you so very much

+ 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