
Let’s say you have daily data and your boss wants to see the trends by week of month or week of quarter? How do you calculate the week number of month or quarter? In this article, let me explain the logic and formulas we can use Excel for this.
Why calculate week in month or quarter?
Calculating “week of month” or “week of quarter” let’s us see trends by week in across months or quarters. Answering business questions like,
- How many customers we had in first of week January vs. first week of February?
- What are the total reservations in first 4 weeks of Q1 vs. first 4 weeks of Q3?
- Cumulative weekly totals for March vs. June
is easier when you have the week of month and week of quarter available in your data.
Step 1: Calculate the WEEKNUM in year

Before we can calculate the weeknum in a month or quarter, we need to do two other important calculations. The first one of them is WEEKNUM in year.
Add a column adjacent to your data and use the below formula to calculate the weeknumber in year.
=WEEKNUM(B4,2)This assumes your date is in the cell B4 and your week begins on Monday. If you want to do the analysis from SUNDAY start, just use =WEEKDAY(B4)
Step 2: Calculate the MONTH number
Our next formula is to figure out which month we are in. Add another column adjacent to your data and use this formula.
=MONTH(B4)At this stage your data should look like this:

Step 3: Calculate Week in Month
Now that we know the “week in year” and “month number”, we can easily calculate the week in month using below formula.
=D4-WEEKNUM(DATE(YEAR(B4),E4,1),2)+1How this “week in month” formula works?
- D4 has the weeknumber in year
- E4 has the month number
- DATE(YEAR(B4),E4,1) tells us the first date of the month (for example, all dates in JAN 2024 will have this as 1-Jan-2024)
- WEEKNUM(DATE(YEAR(B4),E4,1),2) will give us the weeknumber for that date (with Monday start)
- D4-WEEKNUM(DATE(YEAR(B4),E4,1),2)+1 finally tells us the weeknumber of the month (we need to add +1 so that the first week of month will be 1 instead of 0)
[Optional] Step 4: Formula for Week in Quarter
If you need to calculate the “Week in Quarter” for some analysis, you can use the below formula to do that.
=D4-WEEKNUM(DATE(YEAR(B4),INT((E4-1)/3)*3+1,1),2)+1How this “week in quarter” formula works?
- D4 has the weeknumber in year
- E4 has the month number
- INT((E4-1)/3)*3+1 calculates the first month of the quarter (so months 1,2,3 ? 1, 4,5,6 ? 4 … )
- DATE(YEAR(B4),INT((E4-1)/3)*3+1,1) tells us the first date of the quarter (for example, all dates in JAN, FEB, MAR 2024 will have this as 1-Jan-2024)
- WEEKNUM(DATE(YEAR(B4),INT((E4-1)/3)*3+1,1),2) will give us the weeknumber for that date (with Monday start)
- D4-WEEKNUM(DATE(YEAR(B4),INT((E4-1)/3)*3+1,1),2)+1 finally tells us the weeknumber of the quarter (we need to add +1 so that the first week of quarter will be 1 instead of 0)
What if I want Sunday Week Start?
If your week starts on Sunday, you can use the below formulas instead.
'For Week in year
=WEEKNUM(B4)
'For Month number
=MONTH(B4)
'For week in month
=D4-WEEKNUM(DATE(YEAR(B4),E4,1))+1
'For week in quarter
=D4-WEEKNUM(DATE(YEAR(B4),INT((E4-1)/3)*3+1,1))+1For weeks beginning on other days (such as Friday start)
You just need to pass the type of week start to the WEEKNUM() function. Refer to below table to find what you need to use.

Download Sample File with Weeknumber Formulas
If you are having trouble implementing the formulas, refer to free example workbook. It has all the formulas for,
- Calculating week number in year
- Month number
- Week of month
- Week of quarter
In conclusion…
Calculating “week of month” and “week of quarter” is relatively simple and easy process with Excel. Once you have the values in your data, you can use them to better understand the trends across months or quarters. If you have the data in a table, then applying and maintaining these formulas is easy too, as Excel tables auto-extend the formulas for all cells.
Few additional tips to take this idea further:
- Integrate these calculations into Power Query: If you are bringing external data into Excel through Power Query, try adding these columns with Power Query “Add column” feature. Learn more about Power Query here.
- Use a separate calendar table: If you have too many rows of transactional data (like tickets or sales), then instead of calculating the week number for every row, use a calendar table and do the calculations there. After that use “data modeling” feature of Excel to link calendar table to your transactional data. This way you can combine data from both tables in your pivot reports. Learn more about calendar tables and data modeling feature.
Other ways to work with dates
Please refer to these tutorials and examples to solve other date problems in Excel.













11 Responses
Ciao Hui,
Collecting Excel tricks under the title “Notable Excel Websites (Non-MVP) Edition” is a brilliant idea…
Thank you in the name of all The FrankensTeam.
On our site there is a box with a picture and text highlighting:
This is a no-MVP site
we think ourselves “bad boys” a bit 🙂
For those who would like to know why our site is a no-MVP site, enough to click on the link:
http://goo.gl/lxDszY
Thank you again!
Thanks a lot
I really enjoyed this (newsletter). I must admit that I rarely read an Excel newsletter (and I subscribe to quite a few) all the way though, but this grabbed my attention and before I realized it, I was engrossed in it. I must also admit that most of this I don’t understand, yet. But, it excites me when I do learn something new in Excel. I can’t wait to see how much of this I can implement into my (constantly-evolving) ‘House Budget’ & ‘Family Medical’ worksheets that I have developed over the past few years! I sure hope to see more of these type of newsletters in the future! Thanks!
Thanks for doing this Hui! I appreciate being included.
I like Tom’s tip a lot. I posted about a tool I wrote to automate this at http://yoursumbuddy.com/tables-edit-query-dialog/
EXCELLENT !
Hui, This post is Superb! More over I have always been a fan of Roberto’s work and have learnt a lot from him.
Here are some of my recent contributions
1. Customising markers in a chart – http://www.goodly.co.in/customize-markers-in-a-chart/
2. Charting Hacks to work faster – http://www.goodly.co.in/5-charting-hacks-to-help-you-work-faster/
3. 7 Date formulas to make life easy – http://www.goodly.co.in/date-formulas-in-excel/
4. Customised scrollbar using VBA – http://www.goodly.co.in/customized-scroll-bar-in-excel/
5. Adding Direct Legends – http://www.goodly.co.in/customized-scroll-bar-in-excel/
Hope everyone enjoys!
I like the Excel Ninja Menus.
1. Select a cell or range then move till the 4-way cross appears. Right-Click and drag the selection to another place in the worksheet then, like a ninja, a menu full of skills and throwing stars pops up allowing me to do all kinds of awesomeness.
2. When you click the fill box on a Date and right click and drag it down, a lot of amazing Date options pop up.
I also brand my Excel to remind myself that I’m awesome. In my personal macro workbook I place the following code.
Private Sub Workbook_Open()
Application.Caption = “SuperKrishna’s Awesomeness”
End Sub
My favorite tip goes along with #17. If you try to copy subtotaled data (and in earlier Excel versions filtered data),when you paste it all the data displays instead of just the summarized data.
To get around this, select your summarized data, click on Find and Select tab and then select Go to Special. Click Visible cells Only and click OK. Now paste and you will see that only the summarized data has been copied.
You can also go CTRL+G and then click the Special icon at the bottom of the dialog box.
What a great idea, Chandoo! I’d love to be included in your next edition:) Perhaps a VBA exclusive version?
@Ryan
I will review this concept about 6 months out from the original post and be sure to keep your site in mind
Hui…
That sounds great, Hui:) I just realized I gave credit to Chandoo for the idea and I should have attributed it to you.
Sorry about that!