This week number excel

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

This article describes the formula syntax and usage of the WEEKNUM function
in Microsoft Excel.

Description

Returns the week number of a specific date. For example, the week containing January 1 is the first week of the year, and is numbered week 1.

There are two systems used for this function:

  • System 1    The week containing January 1 is the first week of the year, and is numbered week 1.

  • System 2    The week containing the first Thursday of the year is the first week of the year, and is numbered as week 1. This system is the methodology specified in ISO 8601, which is commonly known as the European week numbering system.

Syntax

WEEKNUM(serial_number,[return_type])

The WEEKNUM function syntax has the following arguments:

  • Serial_number     Required. A date within the week. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

  • Return_type     Optional. A number that determines on which day the week begins. The default is 1.

Return_type

Week begins on

System

1 or omitted

Sunday

1

2

Monday

1

11

Monday

1

12

Tuesday

1

13

Wednesday

1

14

Thursday

1

15

Friday

1

16

Saturday

1

17

Sunday

1

21

Monday

2

Remark

  • Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1. January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900.

  • If Serial_number is out of range for the current date base value, a #NUM! error is returned.

  • If Return_type is out of the range specified in the table above, a #NUM! error is returned.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Data

3/9/2012

Formula

Description

Result

=WEEKNUM(A2)

Number of the week in the year that 3/9/2012 occurs, based on weeks beginning on Sunday (default).

10

=WEEKNUM(A2,2)

Number of the week in the year that 3/9/2012 occurs, based on a week beginning on Monday (the second argument, 2).

11

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

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

Week Number in Excel (WEEKNUM)

Week Number (WEEKNUM) is a DATE function in Excel that gives us the week number for the given date in a date. It has two arguments: one which takes a date as an argument which can be a date or a serial number. The other argument is optional, which represents the day on which the week begins. The second argument is optional; however, the first argument is mandatory. The method to use this WEEKNUM function is as follows: =WEEKNUM(serial_number,[return_type]). If the return type is not provided, Sunday is considered one by default.

For example, suppose cell A1 has July 8, 2021, which falls on Thursday. On applying the WEEKNUM Excel function, it will return 28.

=WEEKNUM(A1) 

=28.

Table of contents
  • Week Number in Excel (WEEKNUM)
    • Syntax
    • How to Use the Week Number (WEEKNUM) Function in Excel?
      • Example #1 – Finding Week Number in Excel
      • Example #2 – Add the Word WEEK to the Week Number in Excel
      • Example #3 – Calculate Number of Weeks in excel between Two Dates
      • Example #4 – Calculate the Number of Weeks in Fraction using Excel
    • Things to Remember
    • Recommended Articles

You are free to use this image on your website, templates, etc, Please provide us with an attribution linkArticle Link to be Hyperlinked
For eg:
Source: Week Number in Excel (wallstreetmojo.com)

Syntax

WEEKNUM Formula in Excel

  • serial_number: This is the date. Based on this date, we are trying to find the week number of the date. Excel treats DATE as a serial number.
  • return_type: We need to mention the start of the weekday.

We have 10 different options to supply at the start of the week. Since this is an optional argument, we need not mandatorily supply the argument. However, if we leave this argument blank by default, the value will be 1, i.e., the start of the day of the week is Sunday.

The start of the year, Jan 01, will always be the first week of the year, and Dec 31 will always be the last week of the year, the 54th week.

How to Use the Week Number (WEEKNUM) Function in Excel?

You can download this WEEKNUM Function Excel Template here – WEEKNUM Function Excel Template

Example #1 – Finding Week Number in Excel

Assume you have the below dates. And you need to find the week number in Excel for each date in that particular year.
WEEKNUM Example 1

  1. Open the Excel WEEKNUM function in the B2 cell.

    WEEKNUM Example 1-1

  2. The serial_number is nothing but your date cell. So select A2 as the cell reference.

    WEEKNUM Example 1-2

  3. As of now, ignore the last argument. It will default consider Sunday as the starting day of the week.

    WEEKNUM Example 1-3

  4. Drag the formula to other cells.

    WEEKNUM Example 1-4

  5. We got week numbers for respective dates. But look at the cells A2 and A3; both are on 30th Nov but of a different year. Since Excel considers the start of the week from Sunday, it will vary year to year.

    WEEKNUM Example 1-9

  6. Now, let us change the start of the week to MONDAY.

    WEEKNUM Example 1-5

  7. You can mention the argument as 2. Close the formula.

    WEEKNUM Example 1-6

    The result is shown below:

    WEEKNUM Example 1-7

    Apply to other cells.

    WEEKNUM Example 1-8

    We do not see any differences here. Try changing the starting day of the week to a different date and find the differences.

Example #2 – Add the Word WEEK to the Week Number in Excel

We have seen how to return the week number of any supplied date. It will be cool to add the word “Week” before the week’s number, like in the image below.

WEEKNUM Example 2

It is where the advanced formatting technique in excelFormatting is a useful feature in Excel that allows you to change the appearance of the data in a worksheet. Formatting can be done in a variety of ways. For example, we can use the styles and format tab on the home tab to change the font of a cell or a table.read more comes into the picture. Follow the below steps to apply the above formatting.

  • Step 1: Select all the result cells first.

WEEKNUM Example 2

  • Step 2: Right-click on the selected cells and select “Format Cells.” You can directly press the shortcut key “Ctrl + 1.”

WEEKNUM Example 2-1.1

  • Step 3: Now, we will see below format dialog box. Go to “Custom” first.

WEEKNUM Example 2-1

  • Step 4: Enter the format code “Week” # in the Type: area.

WEEKNUM Example 2-2

  • Step 5: Press “OK.” We will have results ready.

WEEKNUM Example 2-3

Instead of changing the formatting of the cells, we can also combine the word “Week” with the result cells. Refer to the image to apply the same.

WEEKNUM Example 2-4

Example #3 – Calculate Number of Weeks in excel between Two Dates

We have learned the technique of finding the week number of the supplied technique in Excel. But, how do you tell how many weeks are between two dates?

Assume you started the project on 15th Jan 2018, and you completed the project on 30th April 2018. How do you tell how many weeks you had taken to complete the project?

WEEKNUM Example 3

  • Step 1: Firstly, find the difference between the two dates.

WEEKNUM Example 3-1

  • Step 2: Now, divide the difference by 7. We have 7 days a week.

WEEKNUM Example 3-2

  • Step 3: Press the “Enter” key to complete the formula. We have a result like this.

WEEKNUM Example 3-3

  • Step 4: Change the format to “General” for accurate results.

WEEKNUM Example 3-4

Example #4 – Calculate the Number of Weeks in Fraction using Excel

Let us consider one more example to have a clear idea about finding the week’s number between two dates in Excel.

You are going on a business trip from 15th Feb 2018. After all the duties are completed, you are coming back on 30th Jun 2018. Your business head decided to pay you the money weekly.

WEEKNUM Example 4

Now, you must tell me how many weeks you are going on a business trip. Let us apply the same formula we have used in the previous example.

Find the difference between two dates.

WEEKNUM Example 4-1

Now, divide the difference by 7. So we have 7 days a week.

WEEKNUM Example 4-2

We have a result like this.

WEEKNUM Example 4-3

Let us change the format of the resulting cell to fractions.

WEEKNUM Example 4-4

So, we have the number of weeks in fractions now.

WEEKNUM Example 4-5

Things to Remember

  • By default, the start of the week in Excel is SUNDAY.
  • We must supply the return type correctly if you want to start with a different week.
  • If the date is not in the correct format, we may get #VALUE! Error.

Recommended Articles

This article is a guide to WEEKNUM in Excel. We discuss finding week numbers in Excel using the WEEKNUM function, practical examples, and a downloadable Excel template. You may learn more about Excel from the following articles: –

  • Weekday in VBAWeekday in VBA is a date and time function to identify the weekday of a given date provided as an input. This function returns an integer value from 1 to 7 range. There is an optional argument provided to this function which is the first day of the week.read more
  • DATEDIF Function in Excel
  • EDATE Function in Excel
  • DATEVALUE in ExcelThe DATEVALUE function in Excel shows any given date in absolute format. This function takes an argument in the form of date text normally not represented by Excel as a date and converts it into a format that Excel can recognize as a date.read more

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

Bottom line: Learn a few tips and techniques for calculating week numbers from dates, the number of weeks between dates, and how to display the week number in cells for reporting.

Skill level: Beginner

3 Tips for Calculating Week Numbers in Excel - Excel Campus - 640x360

As I mentioned in this week’s newsletter, our baby boy was born last week.  Everything went well with the delivery and we are so happy to have our new little 8-pound bundle of joy in our lives.

Baby Acampora 2017

During my wife’s pregnancy, everything was measured in weeks.  There are 40 weeks in a full term pregnancy, we seemed to have a doctor’s appointment every other week, and we were definitely counting down the weeks until his estimated arrival date.

Of course, I kept track of most of these schedules and calculations in Excel.  So, I wanted to share some of the formulas and calculations I used to calculate week numbers.  These tips will also be useful for financial models, data analysis, and summary reports.  Babies aren’t the only things measured in weeks… 🙂

Download the Example File

Download the example Excel file to follow along with the article.

#1 – WEEKNUM Function: Calculate the Week Number of the Year

We can use the WEEKNUM function to quickly determine how many weeks have elapsed from January 1st  to a given date in the same year.  The following formula returns 11 because 11 weeks have elapsed since January 1, 2017.

=WEEKNUM("3/15/2017")
Result: 11

We can also reference a cell that contains a date.  If the date 3/15/2017 was in cell A2, then the following formula would return the same result.

WEEKNUM Function Calculates Number of Weeks Since Jan 1st

=WEEKNUM("A2")
Result: 11

The WEEKNUM function has an optional argument that allows us to specify the day of the week to start on.  By default, WEEKNUM starts the week on Sunday.  We can change that by adding any of the following numbers to the second argument (return_type).  The image below shows the numbers and days for the return_type argument.

WEEKNUM return_type Argument to Specify Start Day of Week

It’s important to note that the function only calculates the number of weeks from the specified date in the same year.  If we used “3/15/2016” in the WEEKNUM function, the result would be the number of weeks from January 1st, 2016, which is 12.  The week starts on Sunday, so the same date might have a different week number result from year to year.

One drawback of the WEEKNUM function is that we are stuck with January 1st (system 1) or the week containing the first Thursday of the year (system 2).  It would be great if there was a 3rd argument that allowed us to specify the day of the year to start on.  This would be helpful for fiscal year calendars.  Unfortunately, we don’t have that feature yet.

Check out my article on how the calendar date system works in Excel for more details on how dates are stored as numbers.

#2 – Calculate the Number of Weeks Between Dates

To determine how many weeks elapsed between two dates, we can use a simple formula to find the number of days between the dates, then divide by 7.

=(B2-A2)/7

The formula will return a decimal number. We can change the number format to a Fraction to display the number of days.

Change Number Format for Week Number WEEKNUM to Fraction

Or, we can use one of the ROUND functions to ROUND UP or ROUND DOWN to the nearest whole number.

Round functions to round to nearest week number in Excel

This formula can also be used to countdown the number of weeks until your next birthday, vacation, holiday, quarter-end, year-end, etc.  We can use the TODAY() function to return today’s date in a cell.  The date will be updated with the current date every time we open or calculate the workbook.

TODAY Function to Return Current Date for Countdown in Week Numbers

#3 – Display the word “Week” in the Number Format

We might want to display the word “Week” before the week number in the cell.  There are a few ways to do this in Excel.  My preferred method is to use a custom number format to add the word “Week” before the week number.

Custom Number format to Display the word Week before the week number

The custom number format is:

"Week" #

The advantage of the custom number format is that the number remains a number, instead of text.  This makes it easier to sort by week number in filtered ranges and pivot tables.

Sorting Week Numbers with Custom Number Format

If the number is stored as text, it will not sort properly unless we use two digits for the week number.

Week Number stored as text does not sort properly

Therefore, I recommend using the custom number format to keep the data type of the cells as numbers.  This also helps keep the sort order when we create slicers on the Week Number field with the custom number format.

Custom Number Format keeps Sort Order in Pivot Tables and Slicers

I also have an article on 3 ways to display the weekday name of a date.

Other Methods for Calculating Week Numbers?

I hope you enjoyed those tips for working with week numbers in Excel.  These can be very useful for summary reports and week-over-week analysis.

Here are some related articles on working with dates in Excel.

  • How Dates Work in Excel: The Calendar System Explained + Video
  • Filter a Pivot Table or Slicer for the Most Recent Date or Period
  • Grouping Dates in a Pivot Table VERSUS Grouping Dates in the Source Data
  • How to Create Month to Date (MTD) Comparisons with a Pivot Table + Video
  • 3 Ways to Get the Day Name for a Date

What did I miss?  Do you have any additional tips for working with weeks?  If so, please leave a comment below with any suggestions or questions.

Well, I’m off to change a diaper and take a nap…  Thank you! 🙂

Понравилась статья? Поделить с друзьями:
  • This use in a sentence for each word
  • This time i have last word
  • This that these those exercises word
  • This text deals with different 1 of justice the english word justice has several 2
  • This sight word worksheets