+ Reply to Thread
Results 1 to 9 of 9

Excel Formula for grouping dates into weeks

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2013
    Posts
    30

    Excel Formula for grouping dates into weeks

    Hello All,

    Am looking for an excel formula which will help me group dates into weeks.

    For me calendar year starts on 1st November 2015 and end on 31st October 2016.

    Week starts on Monday and ends of Sunday.


    Looking forward to hearing from you all!!


    Regards,
    DJ

  2. #2
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    MA, USA
    MS-Off Ver
    365(PC) V:2412
    Posts
    1,477

    Re: Excel Formula for grouping dates into weeks

    I think an easy way to go about this is to use a helper table on a separate tab similar to the one i have attached. Then depending on your data you can do a vlookup or index match, to get the acquired week number.
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Excel Formula for grouping dates into weeks

    Hi -

    Since I don't have any sample data to look at, I assume your dates are in one lone column. So, copy this into a cell adjacent to your first date and then copy down:

    =IF(WEEKNUM(D8,2)>=44,WEEKNUM(D8,2)-43,WEEKNUM(D8,2)+9)

    This should give you a week number for each date based on weeks starting on a Monday and November 1 being Week 1.

    Note that in the case of 1-Nov-2015 was a Sunday, so 2-Nov-2015 is a Monday and is Week 2. that means 26-Oct through 31 Oct. is in Week 1. You will have calendar oddities like that.

    Hope this helps.
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  4. #4
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Excel Formula for grouping dates into weeks

    One more thing: My test data I experimented with started in cell D8, so you will have to adjust the cell reference when you paste the formula in. Also, once you have week numbers for several dates, you can use COUNTIF, SUMPRODUCT, Pivot Table, etc. to summarize the information as you need.

  5. #5
    Registered User
    Join Date
    05-20-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2013
    Posts
    30

    Re: Excel Formula for grouping dates into weeks

    what would be the formula if week starts from Sunday and ends on Saturday?

  6. #6
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Excel Formula for grouping dates into weeks

    In the WEEKNUM formula, the second element is the start day. So for Monday, you enter 2. For Sunday, you would change the 2's to 1's.

  7. #7
    Registered User
    Join Date
    05-20-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2013
    Posts
    30

    Re: Excel Formula for grouping dates into weeks

    Hello jmor! Your formula works.
    Now what changes do I need to bring about in the formula to pick Monday dates instead of week number

  8. #8
    Registered User
    Join Date
    01-25-2016
    Location
    Ho Chi Minh City, Vietnam
    MS-Off Ver
    Office 2007, Office 2013
    Posts
    7

    Re: Excel Formula for grouping dates into weeks

    Would it help if you can use a PivotTable?

    You can group dates into weeks without the need for formulas:
    1. Create the Pivottable with dates in the Row Labels section
    2. Right click any of the dates and select "Group..."
    3. Select "Days" (unselect any other options), then change "Number of days" to 7.

    When I test it out with some sample data, it selects the earliest date in the data as the start of the week.

  9. #9
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Excel Formula for grouping dates into weeks

    Hi -

    The following formula will result in the serial number for the NEXT Monday of whatever date you put in cell D8. So, for example, if you put Sunday 1-Nov-15 in Cell D8, the next Monday is 2-Nov-15. If you put in 2-Nov-15, the formula yields 2-Nov-15. If you put in 3-Nov-15, the next Monday is 9-Nov-15. And so on.

    =IF(2-WEEKDAY(D8)>=0,D8+2-WEEKDAY(D8),D8+2-WEEKDAY(D8)+7)

    Hope this helps.

+ 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. Formula to convert a range of dates to weeks & days
    By Peggysue in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2014, 02:11 AM
  2. Formula to List Weeks Between Two Dates
    By Necroscope in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-15-2013, 06:53 AM
  3. grouping in weeks
    By penfold1992 in forum Excel General
    Replies: 4
    Last Post: 10-02-2012, 06:00 PM
  4. Grouping by weeks
    By bobwaits in forum Excel General
    Replies: 1
    Last Post: 08-29-2012, 10:02 AM
  5. Grouping dates over two weeks...
    By minkus in forum Excel General
    Replies: 2
    Last Post: 12-13-2010, 04:13 PM
  6. difference between two dates in working weeks(5 day weeks)
    By AWilderbeast in forum Excel General
    Replies: 3
    Last Post: 08-31-2010, 09:21 AM
  7. Graph by grouping dates into 'weeks'
    By Enigma1 in forum Excel General
    Replies: 1
    Last Post: 02-10-2010, 02:28 PM
  8. Replies: 2
    Last Post: 12-01-2009, 01:57 PM

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