Excel formula to get week of month

formulas WEEKNUM

#1 BryanMitchell

BryanMitchell

Newbie

• Members
• 5 posts

Posted 04 November 2013 - 05:35 PM

I'm trying to create a formula to extract the 'week number' of a date within the month.

For example the 1st of November is in Week 1 of November but the 4th of November is in Week 2 (because weeks start on a Monday).

I've been trying to do this with the WEEKNUM function, but I can't get it to work. How do I get the week number?

#2 Jonathan

Jonathan

• 886 posts

Posted 04 November 2013 - 05:49 PM

You're on the right track with the WEEKNUM function, but the formula is rather complex.  To achieve what you want, you'll need to use the following formula:

=WEEKNUM(A1,2)-WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),2)+1

This formula extracts the week of the year (44 for the 1st of November) and then subtracts it from the week of the first day in the month to get the week of the month.

You can change the day that weeks begin by changing the second argument of both WEEKNUM functions (set to 2 in the above example).

For weeks beginning on Sunday, use: =WEEKNUM(A1,1)-WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),1)+1

For weeks beginning on Tuesday, use: =WEEKNUM(A1,12)-WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),12)+1

...etc.

For more about how dates are processed in Excel, see Essential Skills Lesson 4-2: Understand date serial numbers.

I have attached an example spreadsheet showing the formula in action:

If you need any more assistance, feel free to reply.

Jonathan is part of the professional team who answer Excel-related questions posted on the ExcelCentral.com forums.
Jonathan also tests our courses prior to publication and has worked on all of our ten world bestselling Excel books for Excel 2007, Excel 2010, Excel 2013, Excel 2016 for Windows and Excel 2016 for Apple Mac. Jonathan has also worked on over 850 video lessons for or video courses covering Excel 2007, Excel 2010 and Excel 2013.
As well as extensive Excel knowledge, Jonathan has worked in the IT world for over thirteen years as a programmer, database designer and analyst for some of the world's largest companies.

Also tagged with one or more of these keywords: formulas, WEEKNUM

4 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users