+ Reply to Thread
Results 1 to 15 of 15

Custome Week Numbers

  1. #1
    Registered User
    Join Date
    07-14-2021
    Location
    North West, England
    MS-Off Ver
    Office 365
    Posts
    24

    Post Custome Week Numbers

    Hi I have multiple dates spanning back a number of years and forward a number of years.

    For Context, I need the following.

    The week will start on a Friday and end on a Thursday. Week 1 will be on 01st June regardless of the day it starts and week 2 will start on the next Friday (example here is 2023 01st June was a Thursday so this was week 1 then week 2 began the following day as we hit a Friday so a new week began)

    For 2022 I used the following =IF(YEAR(DATE(YEAR(F2),MONTH(F2)-5,1))=2022,WEEKNUM(F2-151,10+WEEKDAY(DATE(YEAR(F2-151),4,1),15)) however this does not work for any year outside 2022.
    Attached Files Attached Files
    Last edited by deanhall99; 07-20-2023 at 05:01 AM.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Custome Week Numbers

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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
    Registered User
    Join Date
    07-14-2021
    Location
    North West, England
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Custome Week Numbers

    Added now, due to the fact this will contain over 100,000 dates I did not see the need but I have done the start of each year to allow for ease fo reading this is not exhaustive. Thank you for your response

  4. #4
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Custome Week Numbers

    In G2 copied down:

    =LET(s,SEQUENCE(20,,-1,12),d,EOMONTH(F2,s)+1,w,WORKDAY.INTL(EOMONTH(d,-1)+1,1,"1111011"),h,HSTACK(d,w),v,VSTACK(HSTACK(VLOOKUP(F2,h,1,1),1),HSTACK(SEQUENCE(52,,VLOOKUP(DATE(YEAR(F2),6,1),h,2,1),7),SEQUENCE(52,,2,1))),VLOOKUP(F2,v,2,1))

    This will work from 2022 to 2041.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-14-2021
    Location
    North West, England
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Custome Week Numbers

    Hi AliGW thank you for this however when we hit the 01st July we error out

  6. #6
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Custome Week Numbers

    Let me look again.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Custome Week Numbers

    In G2 copied down:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Custome Week Numbers

    Still not quite right - looking again.

  9. #9
    Registered User
    Join Date
    07-14-2021
    Location
    North West, England
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Custome Week Numbers

    Thank you,

    On this example when we hit 01/01/2023 we revert back to Week number 1 and then this happens again on 01/02/2023 (DD/MM/YYY)

    I have been struggling with this for a long time now everything I try seems to give me an error at some stage in the journey

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Custome Week Numbers

    This formula works for every year, please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-14-2021
    Location
    North West, England
    MS-Off Ver
    Office 365
    Posts
    24

    Re: Custome Week Numbers

    Thank Hans this seems to work just fine! What date range will this work for?

  12. #12
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Custome Week Numbers

    And if you don't want to copy down the formula, please try this for everything in one go:

    Please empty cells G2:G26 and try in G2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  13. #13
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Custome Week Numbers

    What date range will this work for?
    1 June 1900 until 31 December 9999

  14. #14
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,428

    Re: Custome Week Numbers

    Thanks for the feedback and rep . Glad to have helped.

  15. #15
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Custome Week Numbers

    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.

+ 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. Help with Pivot - Need to get current week and next week numbers
    By Beso90 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-26-2019, 03:54 PM
  2. [SOLVED] Count Week numbers given start and finish week number
    By Vassen in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-30-2016, 01:59 AM
  3. Help with custome sorting
    By cdantonelli in forum Excel General
    Replies: 15
    Last Post: 10-20-2015, 01:45 PM
  4. Replies: 8
    Last Post: 06-28-2014, 03:26 PM
  5. Custome AutoFilter
    By nicolachen in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-21-2007, 01:53 AM
  6. Format numbers in millions? Custome Format?
    By qwopzxnm in forum Excel General
    Replies: 2
    Last Post: 10-05-2007, 03:57 PM
  7. [SOLVED] Custome Colors?
    By Mark in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-21-2005, 11:06 PM

Tags for this Thread

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