+ Reply to Thread
Results 1 to 10 of 10

Find Week in Quarter from Date

  1. #1
    Registered User
    Join Date
    01-26-2012
    Location
    MA
    MS-Off Ver
    Excel Mac 2011
    Posts
    15

    Find Week in Quarter from Date

    I'm trying to figure out how I can determine which week of a calendar quarter a date is in.

    For example,
    Please Login or Register  to view this content.
    However, =WEEKNUM only gives the week in the whole year, I need it to be reset at the beginning of each quarter (Jan-1, Mar-1, July-1, Oct-1).

  2. #2
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Find Week in Quarter from Date

    You can get Quarter number with:
    =LOOKUP(MONTH(A2),{1,4,7,10},{"Q1","Q2","Q3","Q4"})

    But resetting week numbers can be attained with some tweaking of the WEEKNUM but may be a bit inaccurate:
    Please Login or Register  to view this content.
    Ron

    EDIT: Week # formula revised
    Last edited by ron2k_1; 03-27-2012 at 05:27 PM.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

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

    Re: Find Week in Quarter from Date

    Hello Ron, your weeknum formula gives me 2 for 1st July 2011 - I assume that 1st July would always be in week 1

    If week numbers work like WEEKNUM does at the start of the year, i.e. the first day of the quarter is always in week 1, week 2 starts on the next Sunday then this formula should give the week number of the quarter

    =INT((A2-WEEKDAY(A2)-LOOKUP(A2,DATE(YEAR(A2),{1,4,7,10},1)))/7)+2

    .....or this formula also gives the same result.....

    =WEEKNUM(A2)-WEEKNUM(LOOKUP(A2,DATE(YEAR(A2),{1,4,7,10},1)))+1
    Last edited by daddylonglegs; 03-27-2012 at 05:46 PM.
    Audere est facere

  4. #4
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Find Week in Quarter from Date

    Yep, your second formula was something I was trying to get at...

    EDIT: The trick is where the OP wants 1st Jul 2011 in week 14 of Q2 and not week 1 of Q3. Cause if his wish is that week 1 starts on 3rd Jul 2011, then he'll have to live with your formula cause I don't think it can get better than that....

    If you see a short sweet formula like that written by someone with full skills bar - go with that.... I think by now you've exhausted every combination date formulas can be used in. I haven't seen DKO for a while, is he still active?

    Ron
    Last edited by ron2k_1; 03-27-2012 at 06:04 PM.

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

    Re: Find Week in Quarter from Date

    Quote Originally Posted by ron2k_1 View Post
    .....I haven't seen DKO for a while, is he still active?....
    I believe he got a job, now that takes up all the time he use to spend here...

  6. #6
    Registered User
    Join Date
    01-26-2012
    Location
    MA
    MS-Off Ver
    Excel Mac 2011
    Posts
    15

    Re: Find Week in Quarter from Date

    These are great, thank you; however,

    =WEEKNUM(A2)-WEEKNUM(LOOKUP(A2,DATE(YEAR(A2),{1,4,7,10},1)))+1

    is returning Q3 14 for 9/27/11. Should be Q3 13. Q3 starts July 1, ends September 30. Q4 October 1, ends December 31 (week 13). Q1 week 1 is January 1, ends March 31 (week 13). Q2 April 1, ends June 30 (week 13).

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

    Re: Find Week in Quarter from Date

    The formula I suggested works following the logic I outlined in my earlier post, i.e.

    the first day of the quarter is always in week 1, week 2 starts on the next Sunday
    Using that logic 1st July 2011 is in week 1, week 2 then starts on the following Sunday, 3rd July 2011 so week 13 is 18th - 24th September and the remainder of the period (including 27th September) is in week 14. Most quarters will have 14 weeks - quarters 3 and 4 have 92 days each which is 13 weeks and one day - how can you not have a week 14 unless some weeks are longer than 7 days (or you have a week zero)?

    If you can explain your logic then I'm sure the formula can be adjusted to suit

  8. #8
    Registered User
    Join Date
    02-14-2012
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Find Week in Quarter from Date

    Hi Daddylonglegs// your formula is what i was looking for. really appreciate.

    it works fine if the months of quarter are in the same year. if quarter is from last year to this year, it doesn't works

    for example,
    Q1 in my company starts from Nov.

    Q1 : 2011-11 ~ 2012-01
    Q2 : 2012-02 ~ 2012-04
    Q3 : 2012-05 ~ 2012-07
    Q4 : 2012-08 ~ 2012-10

    your formula works perfectly for Q2,Q3,Q4. but not for Q1.

    is there any way for this case??!

    plus, how can i adjust when the week starts?
    which means, week starts from sunday in this formula but if i need to change it to thursday?
    Last edited by realbum; 08-17-2012 at 01:22 AM.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Find Week in Quarter from Date

    realbum,

    Welcome to the Forum, unfortunately:

    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. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  10. #10
    Registered User
    Join Date
    02-14-2012
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Find Week in Quarter from Date

    Quote Originally Posted by arlu1201 View Post
    realbum,

    Welcome to the Forum, unfortunately:

    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. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    sorry for that. i made mistake. i will start another thread.
    it was my first posting to this forum. and i was so excited that i found this solution..

+ 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