+ Reply to Thread
Results 1 to 21 of 21

Number of the Week in Month

  1. #1
    Registered User
    Join Date
    03-26-2008
    Posts
    23

    Angry Number of the Week in Month

    Hi,

    I want to use a formula to calculate what week number in the month it is (i.e 1 to 6) from a particular date.

    I know how to calculate this on an annual basis (i.e. 1 to 52) but not within the month.

    This is what I have so far...


    =IF(OR(D58=1, D58>=D57), ROUNDUP(DAY(D61)/7,0),ROUNDUP(DAY(D61)/7,0)+1)

    d58 is a Weeday formula looking at d61 which is the date i want to look at. d57 is the weekday number of the first day of the month in cell d61.

    I hope this makes sense to you all. Please help, this is driving me insane!

    Thanks

  2. #2
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    =WEEKNUM(D61)-WEEKNUM(D61-DAY(D61)-6)
    No other cells should be necessary for this calculation.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    How about?

    =INT((DAY(D61)-1)/7)+1
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    03-26-2008
    Posts
    23
    Hi Both,

    Unfortunately, neither of those work properly. The Weeknum suggestion seems to return the 30th March as Week 6.

    The second response, the INT function, seems to return Week 4 for the 24th March..

    Thanks anyway though!

    Cheers

    Rob

  5. #5
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    As March begins on Saturday, the 30th is in the sixth week. If you want the week of a particular month to start on the first day of the month, then you would never need week 6, as your first post states, but could just use =ROUNDUP(DAY(D61)/7),0)
    Last edited by darkyam; 03-26-2008 at 09:37 AM.

  6. #6
    Registered User
    Join Date
    03-26-2008
    Posts
    23
    I have W/C Monday 31st March as Week 6...

  7. #7
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    Pardon my ignorance, but what's W/C? I have never heard initials refer to anything except water closet.

  8. #8
    Registered User
    Join Date
    03-26-2008
    Posts
    23
    I'm thinking of the business week as Monday-Sunday. Rather than a week being just 7 consequtive days from the first day of the month. I see what you mean. Eg, 1 and 2 March would be Week 1, then Week 2 would begin on 3rd and so on with Monday remaining as the first day of the week.

  9. #9
    Registered User
    Join Date
    03-26-2008
    Posts
    23
    Week Commencing

  10. #10
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    =weeknum(c31-1)-weeknum(c31-day(c31)-6)
    Last edited by darkyam; 03-26-2008 at 09:57 AM.

  11. #11
    Registered User
    Join Date
    03-26-2008
    Posts
    23
    Hey, that's great thanks! That seems to work perfectly so far

    Cheers

    Rob

  12. #12
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702
    Quote Originally Posted by darkyam
    =weeknum(c31-1)-weeknum(c31-day(c31)-6)
    OK, I'm late, I know.....

    I don't believe that formula will work for most January dates, it gives a negative number......also if 1st of the month is a Sunday, e.g. June 1st 2008, it gives a zero.

    Assuming week 1 always starts on 1st of the month and week 2 begins on the first Monday after that try this formula to give week number

    =INT((13-WEEKDAY(A1-1)+DAY(A1))/7)

    where A1 contains your date

  13. #13
    Registered User
    Join Date
    10-12-2008
    Location
    Alpharetta, GA
    Posts
    1

    Thumbs down Doesn't Work for November 08

    Quote Originally Posted by daddylonglegs View Post
    OK, I'm late, I know.....

    I don't believe that formula will work for most January dates, it gives a negative number......also if 1st of the month is a Sunday, e.g. June 1st 2008, it gives a zero.

    Assuming week 1 always starts on 1st of the month and week 2 begins on the first Monday after that try this formula to give week number

    =INT((13-WEEKDAY(A1-1)+DAY(A1))/7)

    where A1 contains your date
    This doesn't work for November 2008!

    Actually, I have a spreadsheet in which I'm trying to determine how many days are in each week of the month for the month. So if the 1st of the month is on a Sat, there is only one day in the week for the month. If the 30th is on a Mon and there are 30 days in the month, there are only 2 days in that week for the month.

    Any help is greatly appreciated!!!!

  14. #14
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702
    Quote Originally Posted by atrapp View Post
    This doesn't work for November 2008!
    I believe it works in that it does what I said it would. The assumption, as I described, is that week 1 would start on the 1st of the month and week 2 will start on the following Monday

    You seem to want a Sunday start in which case remove the -1 and use

    =INT((13-WEEKDAY(A1)+DAY(A1))/7)

    Of course to count the days in each week for a specific month you'd have to list all the days and then use that formula and count how many days in each week......

    To do that without listing all the days you could do the following:


    Put the 1st of the month of interest in A1, e.g. 1-Nov-2008 (you can format as just mmm-yy)

    In A3 type "week number" and then in A4 to A9 list the week numbers 1 to 6

    In B3 type "days" and then in B4 use this formula
    =MIN(31-DAY(A$1+31),A4*7-WEEKDAY(A$1))+1-SUM(B$3:B3)

    Format B4 as general and then copy formula down to B9

    This will then give you a count of days in each week for any month. Just change the date in A1. If you always want the current month then use this formula in A1

    =TODAY()-DAY(TODAY())+1

    Note: of course weeks 2, 3 and 4 will always have 7 days in any month...
    Last edited by daddylonglegs; 10-12-2008 at 08:04 PM.

  15. #15
    Registered User
    Join Date
    07-29-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Number of the Week in Month

    Hi

    I was looking for a formula that automaticly calculates the no. of weeks in a period

    For example if Cell A1 has 5 for period 5 Cell A2 should display 4 for no. of weeks

    Any help on the above will be highly appreciated.

    Many thanks

  16. #16
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Number of the Week in Month

    Welcome to the forum,

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

  17. #17
    Registered User
    Join Date
    07-29-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Number of the Week in Month

    Sorry about it
    Striving for perfection....

  18. #18
    Registered User
    Join Date
    10-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Number of the Week in Month

    add an if statement should work:
    =IF(MONTH(A2)=1,WEEKNUM(A2),WEEKNUM(A2-1)-WEEKNUM(A2-DAY(A2)-6))

  19. #19
    Registered User
    Join Date
    09-28-2011
    Location
    chicago
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Number of the Week in Month

    if your date is B2, in excel i believe a correct version is

    =IF(DAY(B2)<=(8-WEEKDAY(DATE(YEAR(B2),MONTH(B2),1))),1,IF(DAY(B2)<=(8-WEEKDAY(DATE(YEAR(B2),MONTH(B2),1)))+7*1,2,IF(DAY(B2)<=(8-WEEKDAY(DATE(YEAR(B2),MONTH(B2),1)))+7*2,3,IF(DAY(B2)<=(8-WEEKDAY(DATE(YEAR(B2),MONTH(B2),1)))+7*3,4,IF(DAY(B2)<=(8-WEEKDAY(DATE(YEAR(B2),MONTH(B2),1)))+7*4,5,IF(DAY(B2)<=(8-WEEKDAY(DATE(YEAR(B2),MONTH(B2),1)))+7*5,6))))))

  20. #20
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,702

    Re: Number of the Week in Month

    Wouldn't my suggestion give the same results?

    Quote Originally Posted by daddylonglegs View Post
    =INT((13-WEEKDAY(A1)+DAY(A1))/7)
    Audere est facere

  21. #21
    Registered User
    Join Date
    07-03-2014
    Location
    San Pablo, CA
    MS-Off Ver
    2010
    Posts
    1

    Re: Number of the Week in Month

    Simplicity is marvelous and often overlooked.
    This formula works well, especially rolling over a new year!

    THANK YOU!!!


    Quote Originally Posted by NBVC View Post
    How about?

    =INT((DAY(D61)-1)/7)+1

+ 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