+ Reply to Thread
Results 1 to 9 of 9

Find week within Quarter - more complex

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

    Find week within Quarter - more complex

    Hi all

    I found really great formula from Daddylonglegs in below thread
    http://www.excelforum.com/excel-gene...html?p=2898398

    this is what i was looking for. but it has some limitation for me. i need your wise brain here.

    this formula works great if all quarters are in same year and week starts from Sunday.

    but if the quarter runs thru years, it's not working and also i cannot figure out how i can shift starting day from sunday to other day

    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

    formula works perfectly for Q2,Q3,Q4. but not for Q1. and i can't figure out how i can set start day of week

    the formula i used is from the thread above.

    =INT((A5-WEEKDAY(A5)-LOOKUP(A5,DATE(YEAR(A5),{2,5,8,11},1)))/7)+2


    many thanks in advance

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Find week within Quarter - more complex

    Assuming your Q1 starting date in cell A5
    Ending date is in B5
    Number of weeks from A5 to B5:
    =INT((B5-A5)/7)+1
    Does it meet?
    Quang PT

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

    Re: Find week within Quarter - more complex

    Quote Originally Posted by bebo021999 View Post
    Assuming your Q1 starting date in cell A5
    Ending date is in B5
    Number of weeks from A5 to B5:
    =INT((B5-A5)/7)+1
    Does it meet?
    thanks for reply. but the above table is just to show how i calculate Quarters. not actual data.

    A5 contains date (just ordinary date like 2012-08-20). based on this date, the formula calculate what is the week of quarter

    i didn't tested your formula yet. but if possible, i want to make it simple (which means, without referring data table. just like the formula i wrote in the first post)

    thanks!
    Last edited by realbum; 08-20-2012 at 02:25 AM.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Find week within Quarter - more complex

    It is better if you can upload your sample data

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

    Re: Find week within Quarter - more complex

    the sample data is just simple. just list of dates

    weeknum is what i want to calculate. i used formular : =INT((A2-WEEKDAY(A2)-LOOKUP(A2,DATE(YEAR(A2),{2,5,8,11},1)))/7)+2

    but this formula has limitation as i explained at the first article.

    If i can fully understand about this formula i may able to modify it to fit my needs but i have no brain..

    Please Login or Register  to view this content.

  6. #6
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Find week within Quarter - more complex

    did you tried weeknum?? you can choose there the starting day
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

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

    Re: Find week within Quarter - more complex

    My original formula was as follows:

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

    The {1,4,7,10} part dictates the start month of each quarter, if Quarter 1 starts in November of the previous year then you need to show that with -1 (December would be zero) so that makes the formula

    =INT((A2-WEEKDAY(A2)-LOOKUP(A2,DATE(YEAR(A2),{-1,2,5,8,11},1)))/7)+2

    but that still has weeks starting on Sundays, change WEEKDAY(A2) to WEEKDAY(A2-1) for Monday start, WEEKDAY(A2-2) for Tuesday start etc, so for Thursday start that would be

    =INT((A2-WEEKDAY(A2-4)-LOOKUP(A2,DATE(YEAR(A2),{-1,2,5,8,11},1)))/7)+2
    Audere est facere

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

    Re: Find week within Quarter - more complex

    Thanks daddylonglegs.. you are genius.

    Thanks to all who replied my posting. you saved my life.
    Last edited by Cutter; 08-21-2012 at 11:01 PM. Reason: Removed whole post quote

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Find week within Quarter - more complex

    @ realbum

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, 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.

+ 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