+ Reply to Thread
Results 1 to 12 of 12

Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

  1. #1
    Registered User
    Join Date
    01-15-2023
    Location
    Adelaide, Australia
    MS-Off Ver
    Microsoft 365
    Posts
    7

    Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Hi.
    I've been trying to turn dates e.g. 4 October 2019 into the week number of that year. The formula is working, except when the week falls on a number containing a zero, like week 30, or 40 or 50. In that case it returns the serial number of the date.
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Welome to the forum.

    Try this instead:

    =ISOWEEKNUM(A2)
    Attached Files Attached Files
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Seen, but no response ...

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Use the WeekNum and ISOWeekNum functions to determine the week number of a date.
    These functions differ in how they determine the first week of the year (week 1):
    WeekNum uses the week containing January 1 as the first week of the year. The result from this function can range from 1 to 54.

    ISOWeekNum uses the week containing the first Thursday of the year as the first week of the year. This follows the ISO 8601 date and time standard definition for week numbering. The result from this function can range from 1 to 53. It is possible that 52 or 53 may be returned for the first days of January since the dates could belong to the last week of the previous year.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    01-15-2023
    Location
    Adelaide, Australia
    MS-Off Ver
    Microsoft 365
    Posts
    7

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Thank you for the reply. I've tried that, but it still gives the same serial numbers instead of week numbers.

  6. #6
    Registered User
    Join Date
    01-15-2023
    Location
    Adelaide, Australia
    MS-Off Ver
    Microsoft 365
    Posts
    7

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Sorry, I think I replied in the wrong spot. Thank you for the reply. I've tried ISOWEEKNUM, but same return.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,444

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Provide a workbook showing the problem, if you have one. Did you look at the workbook I prepared for you? It shows the correct results on the right.

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,819

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Try this in B2:

    =TEXT(MIN(WEEKNUM(A2,2),52),"0")

    or, slightly simpler:

    =MIN(WEEKNUM(A2),52)&""

    Hope this helps.

    Pete

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Here's your original workbook with both WEEKNUM and ISOWEEKNUM.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-15-2023
    Location
    Adelaide, Australia
    MS-Off Ver
    Microsoft 365
    Posts
    7

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    Thank you very much. It did not work initially, but after I changed the format to general instead of Date everything worked as it should. I appreciate your help.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    You're welcome. Thanks for the rep.



    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  12. #12
    Registered User
    Join Date
    01-15-2023
    Location
    Adelaide, Australia
    MS-Off Ver
    Microsoft 365
    Posts
    7

    Re: Weeknum function returns serial numbers for weeks 30, 40, 50, instead of week number.

    The second one worked perfectly and it starts January as week 1 and only have 52 weeks in the year. Thank you very much.

+ 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. [SOLVED] Using WeekNum with leading zero on single number week
    By mowens74 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2018, 08:44 AM
  2. [SOLVED] Month Function When Nested inside Text returns incorrect Month Serial Number
    By ibuhary in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2018, 04:12 AM
  3. [SOLVED] Add 12 weeks to date to return week number turn over at 52 weeks
    By nigelog in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-01-2017, 05:58 AM
  4. Need to WEEKNUM function calculate weeks from Feb 1
    By pandyav in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2014, 02:56 PM
  5. Replies: 4
    Last Post: 06-30-2009, 02:40 AM
  6. Function that returns a week number
    By hayaperi in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-13-2007, 09:28 PM
  7. weeknum function returns name error
    By Unison Mike in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-24-2005, 05:06 PM

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