Week of the month in excel

There are at least six different week numbering systems currently in use around the world.  For example, in the USA, Canada and Australia the week begins on Sunday while the ISO standard week begins on Monday.

This article will show you how to got the week of the month whatever system your country uses using the WEEKNUM and ISOWEEKNUM functions.  



  • Excel 365


  • Excel 2021


  • Excel 2019


  • Excel 2016




  • February 12, 2022



  • 22 Comments

It’s not unusual to want to split data into weeks. Excel recognizes this and provides the WEEKNUM function, which converts a date into a number between 1 and 52, representing which week of the year the date falls into.

If you’re unfamiliar with Excel formulas and functions, you could benefit greatly from our completely free Basic Skills e-book, which explains the basics of Excel formulas.

Sometimes you want to extract weeks within months instead of years. For example you want to identify which of your January sales fell into the first, second, third and fourth week of the month. This is much more of a challenge, as Excel doesn’t provide a built-in function that allows you to do this.

How the WEEKNUM function works

It’s important to understand how WEEKNUM works before you can use it to extract the week of month from a date.

WEEKNUM accepts 2 arguments: a date and a rather cryptic Return_type.

The Return_type controls which day the function will treat as the first day of the week. If you set this to 1 Excel will treat Sunday as the first day of the week. If you set it to 2 Excel will treat Monday as the first day of the week.

There are also 7 other options for different week starts. Clicking Help on this function will display a help file showing all of them. You can also see more about getting help in the free Basic Skills e-book.

Extracting the week of the month

The formula to extract the week of month from a date is:

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

The formula works as follows:

  1. Extract the ‘week of year’ from the date.
  2. Extract the ‘week of year’ from the date of the first day of the month the date falls within.
  3. Subtract the two week numbers and add one (so that the first week does not appear as zero).

You can control which day is treated as the first day of the week by changing the second argument in both of the WEEKNUM functions:

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

The DATE, YEAR and MONTH functions are explained in depth in our Expert Skills Books and e-Books.

The ISOWEEKNUM function

ISOWEEKNUM is an alternative function that uses the ISO definition of week numbering. This treats Monday as the first day of the week and treats the first week of the year containing a Thursday as week number 1.

ISOWEEKNUM can be used instead of the WEEKNUM function:

=ISOWEEKNUM(A1)-ISOWEEKNUM(DATE(YEAR(A1),MONTH(A1),1))+1

A working example

You can download an example workbook showing the formula in action:

These are the only up-to-date Excel books currently published and includes the new Dynamic Arrays features.

They are also the only books that will teach you absolutely every Excel skill including Power Pivot, OLAP and DAX.

Some of the things you will learn

Related Articles

excel-sequence-function-tutorial

Excel SEQUENCE Function

This tutorial uses a single Excel SEQUENCE function to create a perpetual calendar. Includes sample files and a step-by-step guide.

Excel formula to get working days between two dates excluding holidays

Calculating loan payment dates

Calculating Loan Payment Dates

This article shows how to calculate loan payment dates in Excel, using a formula that can calculate loans of any length and number of periods.

Share this article

22 Responses

  1. Hi,

    I need to know how to execute the below condition in excel through formulas mentioned in this forum-
    E.g. 29th Oct 2018 to 30th Oct 2018 should fall in first week of November instead of Week 5 of October. In other words, my Week is starting on Saturday, So Oct 2018 will have 4 weeks only and date 29th Oct to 2nd Nov, 2018 should fall in Week 1 of November. The formula I am using as of now is as below –
    =IF(K89=”No Date”,”No Week”,CONCAT(“Week “,WEEKNUM(I89-1)-WEEKNUM(I89-DAY(I89)-6)))

    Please help.

    1. Hi Manoj,
      The WEEKNUM function has an optional argument that lets you specify which day should be treated as the start of the week. To tell WEEKNUM to use Saturday as the first day of the week, use a formula like: =WEEKNUM(I89,16)

      The ‘magic number’ 16 indicates that Saturday should be the start of the week, but you can see a list of all of the week start options in Excel’s help files.

  2. So I have been trying to use the function to track two rolling week dates in excel, and the issue is that i cant get it to work consistently.

    I am tracking Mondays, so using the 2 code.
    The issue is that i need it to accurately roll from identifying the week span of wk5-wk1 to wk1-wk2 and so on. But because of how the week dates are spread apart if i set the spacing so that the mondays get tracked it will either show wk4-wk1 to wk1-wk2 or it will do wk5-wk1 to wk2-wk2.
    Can you help me fix this?

    1. Hi Jacob,
      I’m afraid I’m having some trouble understanding your question, but it might help to know that there are two different algorithms that the WEEKNUM function can use. If you use 21 instead of 2 the function will use the alternate system of week numbers. You can find more information in the help file.

  3. Hi, when I am calculating the week number of 09/27/2019, using =WEEKNUM(A1,2)-WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),2)+1 then the result shows 5. But as per the Indian calendar, it should be 4. How can i get it?

    1. Hi Abhishek,

      The second parameter of the WEEKNUM function offers the choice of two different systems of week numbering. The formula shown above uses system 1, which treats the week containing the 1st of January as the first week of the year.
      My guess is that the Indian calendar may use system 2, which treats the week containing the first Thursday of the year as the first week of the year.

      You can easily modify the formula to use system 2 by changing it to:
      =WEEKNUM(A1,21)-WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),21)+1

      Unfortunately this still seems to return a 5 for the date you mentioned, so my guess is that you may need one of the other options. There are a total of 10 different options that you can use to control how the week number is calculated and you can find them all listed on Microsoft’s help page for the WEEKNUM function.

      1. Great. It works for me.

  4. How do I create a formula that will calculate a monthly date? I need the formula to work so that the date will always be the 2nd week of the month on a Thursday throughout the year (and the next year etc)

    1. Hi Sally

      Our Book “Excel 2019 Construction Kit #1: Calendar and Year Planner” contains many advanced date/time calculations (such as calculating the current phase of the moon from a date).

      One of the problems solved in the book is to calculate the dates of public holidays. A common format for a public holiday is:

      The [Nth] [Day Name] in [Month Name]

      For example, Martin Luther King day is the third Monday in January.

      Finding dates such as the second Thursday in January is very simple for humans to understand but is a little more challenging for Excel. The problem arises because months have a variable number of days and can begin on a different day each year.

      Session 4 of the book suggests three different ways to solve this problem.

      1. By combining the DATE, WEEKDAY and MOD functions.
      2. By combining the DATE, CHOOSE and WEEKDAY functions.
      3. A novel generic solution that uses a simple four argument function call to return the correct answer.

      The first two methods are quite complex but the last makes this type of calculation very simple. The book explains in simple terms how each method can be implemented and how the functions work but, since you asked, here are the formulas (in the context of Martin Luthor King day which falls on the third Monday in January).

      Solution 1. =DATE(CalendarYear,1,15)+ MOD(7-WEEKDAY(DATE(CalendarYear,1,15),3),7)
      Solution 2. =DATE(CalendarYear,1,15)+CHOOSE(7-WEEKDAY(DATE(CalendarYear,1,15),3),1,2,3,4,5,6,0)

      The named range CalendarYear in the example above is the year under consideration.

      For Solution 3 you’d have to study Session 4 in the above book but it enables the same result with a very simple function call by moving much of the logic to a separate table (without any use of macros or VBA code).

      Best Regards

      Mike Smart

  5. Want to calculate attendance on weekly basis. Week starts from Monday and ends on Friday. How I will get numbers of days student is present in a week

    1. Hi Komal

      This is quite easy to do using Excel 365’s SUMPRODUCT dymanic array function. The use of SUMPRODUCT is quite quirky but is explained in depth in the Excel 365 Expert Skills book. It is hard to guess the exact result you are trying to achieve without understanding the structure of your workbook but, in short, you’d begin by creating custom logic arrays to identify the values you wanted to sum and then use one or more SUMPRODUCT functions to sum the rows and columns you had identified.

      If you read and understand the dynamic array session in the Excel 365 Expert Skills book and are still unable to solve the problem feel free to e-mail me an I’ll point you in the right direction.

  6. How to know the nth occurrence of a day of a given date is either 1st, 2nd, 3rd, 4th or 5th in a month?
    e.g.
    29-May-2020 = 5th occurrence of Friday
    15-May-2020 = 3rd Occurrence of Friday in May month.

    1. Hi Quadeer,

      See my answer to Sally above that includes the answer to your question.

  7. Hi Simon,
    I am trying to find out how many weeks in Aug 2020 and weeks should be started from Monday. when i am using above formula its showing week count 6 but as per Aug month it has 5 weeks. Could you please help me.

    1. Hi Shankar

      Here are the week numbers for 1-Aug-2020 and 31-Aug-2020 (obtained with the ISOWEEKNUM formula that regards the first day of the week as Monday and treats the first week of the the year containing a Thursday as week number 1). The ISO standard is the most widely used week numbering standard.

      Monday 31st August 2020 is correctly the sixth week number occurring in the month.

      Your question highlights how important it is to define terminology precisely when designing information systems as “week of the month” is not a carefully enough defined term.

      The question you are receiving the correct answer to is:

      How many different week numbers could any date during this month fall into?
      The correct answer to this question (for Aug 2020) is six.

      The question you are asking might be:
      How many full weeks (Mon-Sat) were there in August 2020?
      The correct answer to this question is four.

      Or it might also be:

      How many Mondays were there in Aug 2020?
      The correct answer to this question is five.

      With the above information I’m sure you can re-phrase your requirement “I am trying to find out how many weeks in Aug 2020” to one of the above three questions. I’m sure you’ll then have no difficulty in creating a formula that finds the right answer.

      Mike Smart

  8. When the date is 08-01-2021 the result of the formula is -51.
    Can you please recheck the formula?
    The one is used is:
    =WEEKNUM(A1,2)–WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),2)+1

    1. Hi Richard

      I’ve just tested this with both 1-Aug-21 and 8-Jan-21 in cell A1 (as it isn’t clear which part of the world you are in so your date could have two meanings). 1-Aug-21 returned 1 and 8-Jan-21 returned 2. The formula was:

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

      I cannot understand how you were able to achieve a result of -51. Try copying and pasting the above formula into our own workbook. Perhaps this will enable you to solve the problem.

      1. Hi Mike,
        I am using this formula =WEEKNUM(A1,2)-WEEKNUM(DATE(YEAR(A1),MONTH(A1),1),2)+1

        to get week number. but its not working. my 1st start date is 1 March 2021 its starting from Monday, it should show 1 week from 1 to 7mar and 8mar to 14 mar as week 2 and onwards. when i reach to 29th march to 4th April it should show result as 1 week but instead of it its showing 5th week. again if i reach to 5th April to 11 April it should show 1st week but showing 2nd week.

        kindly help.

        1. Hi Sandeep

          Your formula calculates two numbers:

          1/ The week number that the first day of the month falls within. In the case of 1st April 2021 this is week 14 of the year (you have opted for System 1 when the week containing January 1st is considered the first week of the year and is numbered 1. You have also set the week to begin on Monday).

          1st Jan 2021 was a Friday so the first three days of 2021 were in Week 1 and then 4th Jan began Week 2.

          29 Mar -4 April is thus Week 14 of the year and 5 April to 11 April is Week 15.

          To determine the week number of the current month you are taking the week number of the year and subtracting the week number that the 1st of the month was within. In this case the 1-Apr-2021 is in week 14. For this reason 1-4 April 2021 fall in the 1st week of the month and the second week begins on 5th April 2021 so the results you are seeing are correct.

          There are many ways of defining the “Week of the month” used throughout the world. Your question highlights how important it is to define terminology precisely when designing information systems as “week of the month” is not a carefully enough defined term.

          I’m guessing that your actual requirement is:

          “Regard the 1st of each month, and the six days that follow, as “Week 1” and increment the week number every seven days. When the 1st of the next month comes around, reset week numbering to “Week 1 again”.

          This is easily done of course, using nothing fancier than a little math and a thorough understanding of Excel date serial numbers (covered extensively in both the Essential Skills and Expert skills books). Perhaps your requirement is different again? Whatever it is you should be able to design a solution using date serial number offsets, perhaps in conjunction with the WEEKNUM function.

          I hope that the above information enables you to design the solution that you need.

        2. Hi Sandeep

          The formula calculates two numbers:

          1/ The week number that the first day of the month falls within. In the case of 1st April 2021 this is week 14 of the year (you have opted for System 1 when the week containing January 1st is considered the first week of the year and is numbered 1. You have also set the week to begin on Monday).

          1st Jan 2021 was a Friday so the first three days of 2021 were in Week 1 and then 4th Jan began Week 2.
          29 Mar -4 April is thus Week 14 of the year and 5 April to 11 April is Week 15.

          To determine the week number of the current month you are taking the week number of the year and subtracting the week number that the 1st of the month was within. In this case the 1-Apr-2021 is in week 14. For this reason 1-4 April 2021 fall in the 1st week of the month and the second week begins on 5th April 2021 so the results you are seeing are correct.

          There are many ways of defining the “Week of the month” used throughout the world. Your question highlights how important it is to define terminology precisely when designing information systems as “week of the month” is not a carefully enough defined term.

          I’m guessing that your actual requirement is:

          “Regard the 1st of each month, and the six days that follow, as “Week 1” and increment the week number every seven days. When the 1st of the next month comes around, reset week numbering to “Week 1 again”.

          This is easily done of course, using nothing fancier than a little math and the date serial number (covered extensively in both the Essential Skills and Expert skills books). Perhaps your requirement is different again?

          I hope that the above information enables you to design the solution that you need.

  9. I’m getting odd results for May and Aug of 2021. I have a column (A) of Friday dates and I am trying to find which Friday of the month each of these dates represent – 1st friday of the month, 2nd friday of the month, etc. Tried each of these:
    =WEEKNUM(A2,1)-WEEKNUM(DATE(YEAR(A2),MONTH(A2),1),1)+1
    shows May 7 as 2nd week and the other May fridays are one week off
    =WEEKNUM(A2,2)-WEEKNUM(DATE(YEAR(A2),MONTH(A2),1),2)+1
    shows May 7 as 2nd week and Aug 6 as 2nd week and other fridays in those months are similarly one week off

    1. Hi Scott

      To set Friday as the first day in the week you need to use 15 as the second argument for the weeknum function:

      For Friday 7th May 2021

      =WEEKNUM(A2,15)

      … returns week 19 as Friday 7th May begins Week 19 (as May 2021 began on a Saturday)’

      =WEEKNUM(DATE(YEAR(A19),MONTH(A19),1),15)

      .. returns week 18 as (on 1st May 2021) the first Friday in May 2021 has not yet arrived.

      The sum 18-17 returns 1 making Friday 7th May 2021 as the first Friday in the month of May 2021.

      For your requirement you do not need to subtract one because you do not want the days prior to Friday to be regarded as week 1 of the month in question. Given this you should appreciate why:

      =WEEKNUM(A19,15)-WEEKNUM(DATE(YEAR(A19),MONTH(A19),1),15)

      … will correctly identify 7th May 2021 as being the first Friday in May 2021.

Leave a Reply

Using excel formula I need to get week number in month from a given date. But, the condition is it should have Monday in it. Monday through Sunday is the work days.

I have tried this:

enter image description here

But, week number is given as 5, where as it should be 4 because 1st November 2013 was Friday, so it would be calculated in October’s last week.

asked Dec 16, 2013 at 20:54

Jonathan from the ExcelCentral forums suggests:

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

This formula extracts the week of the year […] 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 [for Monday] 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.

I like it better because it’s using the built in week calculation functionality of Excel (WEEKNUM).

answered Mar 2, 2015 at 12:32

Ohad Schneider's user avatar

Ohad SchneiderOhad Schneider

36k14 gold badges165 silver badges196 bronze badges

1

If week 1 always starts on the first Monday of the month try this formula for week number

=INT((6+DAY(A1+1-WEEKDAY(A1-1)))/7)

That gets the week number from the date in A1 with no intermediate calculations — if you want to use your «Monday’s date» in B1 you can use this version

=INT((DAY(B1)+6)/7)

answered Dec 16, 2013 at 21:01

barry houdini's user avatar

barry houdinibarry houdini

45.5k8 gold badges63 silver badges80 bronze badges

2

Finding of week number for each date of a month (considering Monday as beginning of the week)

Keep the first date of month contant $B$13

=WEEKNUM(B18,2)-WEEKNUM($B$13,2)+1

WEEKNUM(B18,2) — returns the week number of the date mentioned in cell B18

WEEKNUM($B$13,2) — returns the week number of the 1st date of month in cell B13

Hakan ERDOGAN's user avatar

answered Jun 5, 2018 at 7:38

Prabhamayee Mishra's user avatar

Summary

To get the week number from a date, you can use the WEEKNUM function. In the example shown, the formula in C5, copied down, is:

=WEEKNUM(B5)

Generic formula

Explanation 

The WEEKNUM function takes a date and returns a week number (1-54) that corresponds to the week of year. The WEEKNUM function starts counting with the week that contains January 1. WEEKNUM takes two arguments: a date, and (optionally) return_type, which controls the scheme used to calculate the week number. 

By default, the WEEKNUM function uses a scheme where week 1 begins on January 1, and week 2 begins on the next Sunday (when the return_type argument is omitted, or supplied as 1). With a return_type of 2, week 1 begins on January 1, and week 2 begins on the next Monday. See the WEEKNUM page for more information.

ISO week number

ISO week numbers, start on the Monday of the first week in a year with a Thursday. This means that the first day of the year for ISO weeks is always a Monday in the period between Jan 29 and Jan 4. Starting with Excel 2010, you can generate an ISO week number using 21 as the return_type:

=WEEKNUM(date,21)

Starting in Excel 2013, there is a new function called ISOWEEKNUM.

For more details, see Ron de Bruin’s nice write-up on Excel week numbers.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi — I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.

I just wanted to say thanks for simplifying the learning process for me! Your website is a life saver!

Get Training

Quick, clean, and to the point training

Learn Excel with high quality video training. Our videos are quick, clean, and to the point, so you can learn Excel in less time, and easily review key topics when needed. Each video comes with its own practice worksheet.

View Paid Training & Bundles

Help us improve Exceljet

Originally written by Analytics Demystified on January 15, 2013

I often find myself getting data out of one system or another (or multiple systems, and then combining them) as “daily” data — a series of metrics by day for a sequence of days. Sometimes, I work with that data at a daily level, but, often, I want to roll the data up by week, by month, or by some other time period.

For instance, if I want to look at the data weekly, I’ll use either the last day of the week or the first day of the week and then use a formula in a new column to convert each actual day to the “week” in which it falls:

Excel Date Conversion

In the example above, 1/15/2013 is a Tuesday that falls in a week that ends on Saturday, 1/19/2013. The same holds true for Wednesday (1/16), Thursday (1/17), Friday (1/18), and Saturday (1/19). As soon as get to 1/20/2013 (Sunday), I’m in a new week — a week that ends on 1/26/2013. Make sense?

By adding this column, I can create a pivot table that can easily generate weekly data for whatever metrics are in the spreadsheet.

This approach works for a number of different ways you might need to roll up daily data, so I thought a post that walks through some of the more common ones and the formula to carry out each conversion was in order. I’ve put all of the examples in this post in a downloadable spreadsheet that you can check out and play around with.

Day of Week

The WEEKDAY() function returns a number — 1, 2, 3, 4, 5, 6, or 7. But, what if you actually want the day of the week in plain English?

Excel Dates: Weekdays

You can use the CHOOSE() function and hard code values. Or, you can make a separate table that maps a number to each weekday and use VLOOKUP to populate the values. I’m not going to discuss either of those approaches…because my preferred approach is to use the TEXT() function.

For the fully written out weekday (“$A3” is the cell with 1/15/2013 in it — you would just drag this formula down, or, if you’re using an Excel Table, it would autofill):

=TEXT($A3,”dddd”)

For the 3-letter weekday:

=TEXT($A3,”ddd”)

Easy-peasy, no?

Note: If you simply want the date to be displayed as the weekday, you don’t need a formula at all — you can simply change the cell formatting to a custom format of “dddd” (for the full weekday) or “ddd” (for the 3-letter weekday). If you do that, the display of the data will be as a weekday, but the underlying value will still be the actual date. This formula actually makes the value the weekday. Depending on what your needs are, one approach or the other will make more sense.

Convert to “Week Of”

The example I started this post with is converting each day to be the day that ends the week or the day that starts the week. To do this, you can use the WEEKDAY() function. The easiest way to understand how this works out is to write out (or put in Excel) a series of dates and then write the numbers 1 through 7 as you go down the dates. The farther you go into a week, the bigger the WEEKDAY() value is. So, if you subtract the WEEKDAY() value from the actual date, you will get the same value 7 days in a row, at which point the value will “jump” seven days. Make sense (it’s confusing…until it’s not)?

So, to convert a date to be the Saturday of the week the date falls in, use this formula (the “+7” just keeps the converted value from being the Saturday of the previous week):

=$A3-WEEKDAY($A3)+7

It’s the same idea if you wanted to use the first day of the week, with the week defined as starting on Sunday:

=$A3-WEEKDAY($A3)+1

Obviously, you can use this basic formula for whatever “week” criteria you want. You just have to either think about it really hard…or experiment until it’s doing what you want.

Convert to Bi-Weekly Date

Sometimes, a company operates on a bi-weekly cycle in some ways. For instance, a lot of companies pay their employees every two weeks. WEEKDAY() doesn’t work for this, because it doesn’t tell you which of the two weeks a day falls into.

In this case, I use MOD(). This function is, basically, a “remainder” function, and its main use is to calculate the remainder when one number is divided by another (for instance, “=MOD(14,4)” returns “2” because, when you divide 14 by 4, you get a remainder of 2).

Well, Excel dates are, under the hood, just numbers. You don’t really need to know exactly what number a date is (although you can change the cell formatting to “Number” when a date is displayed and you will see the number). But, if you think about it, if you divide a date by 14, it’s going to have a remainder between 1 and 13. Let’s say the remainder is “2.” So, what will the remainder be if you divide the next day by 14? It will be “3.” And so on until you get to 13, at which point the next day, if divided by 14, will have a remainder of 0. Hmmm. This seems like we’ve recreated the WEEKDAY() function used above…but with a 14-day long period instead of 7-day one, right? Exactly!

So, if we wanted to convert a date to be the Saturday at the end of the bi-week period, it would be one of these two formulas (depending on which Saturday is the cutoff and which is the mid-period point):

=$A3-MOD($A3-1,14)+13

or

=$A3-MOD($A3-8,14)+13

If you wanted to use the start of the period, with the week starting on Sunday, then it would be one of these two formulas:

=$A3-MOD($A3-1,14)

or

=$A3-MOD($A3-8,14)

Again, it takes some experimentation if you want to adjust to other dates, but the “14” will not change as long as you’re working on bi-weekly periods.

Convert to Bi-Monthly Date

Sometimes (again, company pay periods are a good example), rather than using a bi-weekly calendar, you want to use a bi-monthly calendar — every date from the 1st through the 14th should be converted to the first day of the month, and every day from the 15th through the end of the month should be coded as the 15th. To do this, we use the DATE() function with an IF() statement for the day value:

=DATE(YEAR($A3),MONTH($A3),IF(DAY($A3)<15,1,15))

We know the year is the YEAR() of the date being converted, and we know the month is the MONTH() of the date being converted. But, we need to look at the day of the month and check if it is less than 15. If it is, then we return a day value of “1,” and, otherwise, we return a day value of “15.”

Convert to Monthly Date

Monthly is almost as common, if not moreso, than weekly. To convert to the first day of the month is a straightforward use of the DATE() function. We pull the year using the YEAR() function on the date we’re converting, the month using the MONTH() function on the date we’re converting, and then simply hard code the “day” as “1:”

=DATE(YEAR($A3),MONTH($A3),1)

But, what if we want to use the last day of the month? We can’t hard code the “day” value because that day could be 28, 29 (leap year), 30, or 31. Curse you, Gregorian calendar!!!

Well, actually, this isn’t all that complicated, either. Why? Because the last day of the month is always the day before the first day of the next monthHuh? That’s right. That’s how we get the last day of the month: we use the DATE() function to figure out the first day of the next month (by adding 1 to the MONTH() value)… and then subtract 1:

=DATE(YEAR($A3),MONTH($A3)+1,1)-1

How do you like them apples?! [idiom ref.]

As an interesting aside, it would be understandable if this formula broke for the month of December. In that case, you’re actually telling Excel to calculate a date where the month is “13.” Luckily, Excel figures out what you mean and winds up returning January 1 of the following year (from which the formula then subtracts one to return December 31st).

But, What About…

I’ve just scratched the surface with possible date conversions in this post. Hopefully, the different approaches I described will trigger an idea or two for your specific situation. But, if you’ve got one that is stumping you, leave a comment here and I’ll take a crack at it!

And, all of the examples here are included in this downloadable spreadsheet. You can change the “start date” in cell A3 and all of the subsequent dates will automatically update. Happy date converting!

Week Numbers in Excel

Excel Week Numbers (Table of Contents)

  • Week Numbers in Excel
  • How to use Week Number (WEEKNUM) Function in Excel?

Week Numbers in Excel

It is quite a painful job to find out week number for a specific date manually. What if I tell you, excel does this job of finding week number for you? Yes, you heard it right! Excel can calculate the week number for a specific date or set of dates and give a week number for you with the help of the WEEKNUM function. Yes, only one specific function (less confusion, right?). However, this one function itself could be confusing some of the times. Let’s go through and see how it works and helps us find out the week number in excel.

Syntax for WEEKNUM Function in;

The syntax for the excel WEEKNUM function, which outputs week number from a given date value, is as below:

Week Numbers syntax

Where,

  • serial_number: is a date value for which you want to calculate the week number. It can be a reference of the cell which is containing your date value.
  • return_type: is a number which can let excel know on which day the week has started. This is an optional but really very useful argument which can be confusing at the same time.

When the above formula is entered on a date argument, Excel finds out the week number for that date and returns a number from 1 to 52 (as there are 52 weeks in a year).

How to use Week Number (WEEKNUM) Function in Excel?

Let’s understand how to use the Week Number Function in Excel by using some examples.

You can download this Week Numbers Excel Template here – Week Numbers Excel Template

Week Numbers in Excel – Example #1

Simple WEEKNUM Function in Excel (Without [return_type]):

As you might have paid attention above, return_type is an optional argument and can be omitted. If omitted, Excel considers that the first week of the year starts on January 1st, and the last week (i.e. week number 52) will be December 31st.

What if you ignore the return_type? Is it OK? Will Excel still count the week number for a date?

The answer to all these questions is affirmative. Let’s see an example and have a practical understanding of the same.

Suppose we have data as shown in the image below, which has different dates in each cell.

Week Numbers (Date)

Put the formula =WEEKNUM(A2) in cell B2 and hit Enter. 

Excel will return a week value for the date in cell A2. See the screenshot below for a better understanding:

Since we have omitted the return_type, Excel considered that the week starts from January 1st and it’s a week from Sunday to Sunday (Though 1st January 2017 was actually a Sunday, It becomes confusing when the 1st day of the year does not fall on Sunday).

Week Numbers(week starts)

Let’s drag the formula for all the cells and see the values for the week number corresponding to every date value.

See the below example for your reference:

the values for week number

This was pretty simple till here, right?

Week Numbers in Excel – Example #2

WEEKNUM Function with return_type:

In the previous section, we ran the function without providing the return_type. Which means, by default, the week starts on 1st January and assumes that it is Sunday.

But which may not be the case of our interest always. Our week might start on Monday, Tuesday etc., at the start of the year.

Therefore, the return_type is there.

return_type has the following list of values supported, and you can also see those when you use it under the WEEKNUM formula.

return_type

All the above values for argument are used under the WEEKNUM function.

Let’s play around with some of the return_type values and see the magic.

Suppose you wanted your week to be starting from Monday, then give return_type as 2 under the WEEKNUM formula and see if any change in week numbers.

See the below screenshot for your reference.

WEEKNUM formula

Week Numbers example 1-5

As you can see through highlighted cells, the week number values have changed when we have used return_type as Monday (i.e. 2). It happened because 1st January 2017 is falling on Sunday. So ideally week should have started from the date. But as we have provided the return_type as Monday, Excel considers that the week is about to start from the first Monday of 2017 (which is 2nd January 2017), and hence there is an increase in week value.

Week Numbers in Excel – Example #3

ISOWEEKNUM function:

ISOWEEKNUM function allows you to find out the ISO week number of the week for a particular date. This function is as per the ISO standards, which says the week starts on Monday, and the week containing the first Thursday is considered as the first week of the year. This function will give you a week value from 1 to 52, specifying on which week the date value falls.

ISOWEEKNUM Formula

The syntax for ISO week is as above, where the argument named to date is required for the function to calculate the week number as per the ISO standards.

Let’s see some examples of this.

Week Numbers ( syntax for ISO week)

Suppose we have a date 1st January 2017, which is Sunday. The value the ISOWEEKNUM function gives is 52, which denotes the last week of 2016. Because the week starts on Monday under ISOWEEKNUM and the date is falling on Sunday.

As 2nd January 2017 falls on Monday, ISOWEEKNUM gives week value as one.

Now suppose a date 1st January 2015, which is a Thursday. ISOWEEKNUM considering it as the first week of the year, and the same you can see under output.

So, these were some of the examples on week numbers. I hope this article helps you get in the concept right. I will suggest having some more practice with different return_type values under the function to gets hands-on with it.

Things to Remember

  • return_type can be omitted in excel. However, omitting leads to the start of the week from 1st January of the year, and excel considers that it’s a Sunday.
  • return_type “21” can only be used under the ISOWEEK numbering system.
  • ISOWEEKNUM function only requires one argument called date. It should be the cell which contains the actual date for which you wanted to calculate the week number as per ISO standards.
  • General WEEKNUM functions provide week numbers from 1 to 54. However, the ISOWEEKNUM function provides week numbers only from 1 to 52.

Recommended Articles

This has been a guide to Week Numbers in Excel. Here we discussed How to find week numbers and How to use the WEEKNUM and ISOWEEKNUM Function in Excel, along with practical examples and a downloadable excel template. You can also go through our other suggested articles –

  1. Month Function in excel
  2. Excel Formula for Weekday
  3. WEEKDAY Function Excel
  4. Insert Calendar In Excel

Понравилась статья? Поделить с друзьями:
  • Week numbering in excel
  • Week meaning of the word
  • Week by week excel template
  • Week after next word
  • Week 1 your word day 1