+ Reply to Thread
Results 1 to 11 of 11

Need to find the week number of the month, first of the month not always the 1st week

  1. #1
    Registered User
    Join Date
    01-16-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    4

    Need to find the week number of the month, first of the month not always the 1st week

    I need a formula that will find the week number of a month. Sometimes, there are 5 weeks in a month and I need the formula to be able to adapt to that. I want to take the data out of one cell that has a date in it. My workplace has Excel 2003, and I can't use any macros or add-ins. The formula needs to be made from existing formulas in Excel 2003.

    For example: The date I am referencing for the formula is January 1, 2012. I need the formula to reflect that this is week 1, but just the number, not the word week. If I were to reference the same cell that originally had January 1st in it with a different date, say February 29, 2012, then I need the formula to display that this is week 5.

    I define the first or last week of a month by whatever month has the most days in the week. For January of this year - the 29th, 30th, and 31st are in the first week of February because February has 4 out of 7 days in the week.

  2. #2
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Need to find the week number of the month, first of the month not always the 1st

    Hi Jerse.. Welcome to the forum.
    This is a formula by Daddylonglegs & appears to do exactly what you're after
    Please Login or Register  to view this content.
    If the formula's in B1 & you enter a date in A1, B1 will show the week number
    Have fun

  3. #3
    Registered User
    Join Date
    01-16-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need to find the week number of the month, first of the month not always the 1st

    hey philb1,

    thanks for the response and the welcome! however, i'm looking for a formula that will only display the numbers 1-5 for the week numbers. having the week number of a particular month, not the year, is what i'm trying to get at. i'd also like the formula to understand that the first day of the week is sunday.

    another example: february 1st, 2012 - which falls on a wednesday - is in week 1 of february, while march 1st, 2012 - which falls on a thursday - is considered to be in week 5 of february because the last days of february take up 4/7 days of the week while the first days of march only take up 3/7 days of the same week.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Need to find the week number of the month, first of the month not always the 1st

    Perhaps this link could be of help?

    http://office.microsoft.com/en-us/ex...005209337.aspx

    Alf

  5. #5
    Registered User
    Join Date
    01-16-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need to find the week number of the month, first of the month not always the 1st

    her alf,

    thanks, but the weeknum function in excel 2003 is only available by using the add-in.

    ive literally been thinking about how to do this for the past few hours but can't get around it without creating an additional table with all the dates and week numbers all ready inside of it...

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

    Re: Need to find the week number of the month, first of the month not always the 1st

    Try this formula

    =INT((6+DAY(A1-WEEKDAY(A1)+4))/7)
    Audere est facere

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Need to find the week number of the month, first of the month not always the 1st

    Hey Jerse and welcome to the forum,

    Try
    Please Login or Register  to view this content.
    for the week of a date in its month.
    See the attached with examples and the above formula.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  8. #8
    Registered User
    Join Date
    01-16-2012
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need to find the week number of the month, first of the month not always the 1st

    Thanks, this worked great.

    For those of you who use this afterwards, I used the A1 value on the Wednesday of the week so that the formula knows which month has the greater number of days in the either week 5/ week 1

    Quote Originally Posted by daddylonglegs View Post
    Try this formula

    =INT((6+DAY(A1-WEEKDAY(A1)+4))/7)

  9. #9
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Need to find the week number of the month, first of the month not always the 1st

    Hey Jerse,

    I tried DLL's formula above in column F of my workbook below and couldn't get my answers.
    I guess I didn't understand the problem.
    Is Dec 3, 2011 in week 1 and Dec 4, 2011 in week 2?
    What was I missing? Did you try my formula and sheet below?

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

    Re: Need to find the week number of the month, first of the month not always the 1st

    Marvin,

    I believe that every week should have 7 days, starting on Sunday and ending on Saturday. The only issue then is where week 1 starts. Jerse's stipulation is that week 1 is the first week with most of the days in the relevant month, so that means week 1 starts with the first Sunday that occurs on or after 1st of month -3

    Note that my formula should work for any date, A1 doesn't need to be a Wednesday

  11. #11
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Need to find the week number of the month, first of the month not always the 1st

    Hey DLL,

    Thanks - My assumption was different than your above. Looking at December 2011, I had the first three days in week 1 with Dec 4th being in week 2.

    This reminds me of people who say "next Thursday". Some mean in a few days and others mean the Thursday after the next Thursday.

    Thanks for the answer - I was just wrong with what was meant by "first week".

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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