Today’s author is, Ron de Bruin, an Excel MVP. You can find more useful tips from Ron and links to Excel add-ins at his website: http://www.rondebruin.nl/
There are four primary week numbering systems in use worldwide. Each system has subtle differences that you should be aware of. Excel can work with any of these systems:
1) ISO Week number: The International Organization for Standardization (ISO) ISO8601:2000 Standard.
All weeks begin on a Monday. Week one starts on Monday of the first week of the calendar year with a Thursday.
2) Excel WEEKNUM function with an optional second argument of 1 (default).
Week one begins on January 1st; week two begins on the following Sunday.
3) Excel WEEKNUM function with an optional second argument of 2.
Week one begins on January 1st; week two begins on the following Monday.
4) Simple week numbering.
Week one begins on January 1st, week two begins on January 8th, and week 53 has only one or two days (for leap years).
Note: Excel does not have a standard worksheet function for the ISO week number and simple week numbering system.
Worksheet Formulas for Week Numbers
The following sections assume that you have a date in cell B4 for testing the week number formulas.
ISO Week Numbers
There is no built-in worksheet function for ISO week numbers in Excel. Copy the following formula and paste it in a worksheet cell to return an ISO week number:
=INT((B4-DATE(YEAR(B4-WEEKDAY(B4-1)+4),1,3)+WEEKDAY(DATE(YEAR(B4-WEEKDAY(B4-1)+4),1,3))+5)/7)
Alternatively, you can open the Visual Basic editor, click Module on the Insert menu, and then copy this user-defined function (UDF) into the module. After adding this UDF to your workbook, you can use it like a built-in function =IsoWeekNumber(B4)
Public Function IsoWeekNumber(d1 As Date) As Integer ' Attributed to Daniel Maher Dim d2 As Long d2 = DateSerial(Year(d1 - WeekDay(d1 - 1) + 4), 1, 3) IsoWeekNumber = Int((d1 - d2 + WeekDay(d2) + 5) / 7) End Function
In VBA you could also use:
DatePart("ww",date,vbMonday,vbFirstFourDays)
However, because there is a bug with the VBA DatePart function with respect to ISO week numbers, it is not a good option to use it. Use the VBA IsoWeekNumber function above to avoid problems. For more information on the DatePart method bug, see this KB article: BUG: Format or DatePart Functions Can Return Wrong Week Number for Last Monday in Year.
You can find more information about ISO dates and week numbers on this page: http://www.rondebruin.nl/isodate.htm
The Excel WEEKNUM Function
Reliance on the Analysis Toolpak in Excel versions before Excel 2007 can create problems because the add-in may not
be installed by users of your spreadsheets (a default Excel installation has it unchecked in setup). Also, there are difficulties for international users when you use Analysis Toolpak formulas because these formulas are not translated by Excel if you open the workbook in a different Excel language version.
Note: In Excel 2007 WEEKNUM is a standard built-in worksheet function, so you will not have the problems above if you share your workbook between different Excel 2007 language versions.
Important: If you do not have Office 2007 SP2 installed, read the information on this page: http://www.rondebruin.nl/atp.htm
You can use these two replacement functions from Daniel Maher to avoid problems.
Replace =WEEKNUM(B4,1) with:
=1+INT((B4-(DATE(YEAR(B4),1,2)-WEEKDAY(DATE(YEAR(B4),1,1))))/7)
Replace =WEEKNUM(B4,2) with:
=1+INT((B4-(DATE(YEAR(B4),1,2)-WEEKDAY(DATE(YEAR(B4),1,0))))/7)
Simple Week Numbers
There is no built-in worksheet function for simple week numbering in Excel. Copy the following function and paste it in a worksheet cell to return simple week numbers:
=INT((B4-DATE(YEAR(B4),1,1))/7)+1
The Week Calendar File
The week calendar file shows you all the dates and week numbers from a certain year on one printable page. If you want to have a week calendar from another year you only have to change one cell (the year). There is a separate sheet for each of the four week numbering systems listed at the start of this post.
Download the Calendar file
Week Numbers Calendar.zip (File date : 27-Feb-2005)
Acknowledgements
I would like to acknowledge general reference on all date issues to:
Chip Pearson: http://www.cpearson.com/excel/topic.aspx
Dave McRitchie: http://www.mvps.org/dmcritchie/excel/xlindex.htm
Daniel Maher has also published numerous simplifications of date formulas some of which were used or adapted in producing the calendar.
The late Frank Kabel Frank created the ISO week number worksheet function on this page.
The base formula used for the ISO year start in the calendar file were derived from a UDF written by John Green, Sydney.
More Information
ISO Date Representatation and Week Numbering:
http://www.rondebruin.nl/isodate.htm
You should refer to Chip Pearson’s web site for an exposition on Week Number implementation:
http://www.cpearson.com/excel/weeknum.htm
Implementing Week-Numbering Systems and Date/Time Representations:
http://msdn.microsoft.com/en-us/library/bb277364.aspx
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
- 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.
- Open the Excel WEEKNUM function in the B2 cell.
- The serial_number is nothing but your date cell. So select A2 as the cell reference.
- As of now, ignore the last argument. It will default consider Sunday as the starting day of the week.
- Drag the formula to other cells.
- 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.
- Now, let us change the start of the week to MONDAY.
- You can mention the argument as 2. Close the formula.
The result is shown below:
Apply to other cells.
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.
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.
- Step 2: Right-click on the selected cells and select “Format Cells.” You can directly press the shortcut key “Ctrl + 1.”
- Step 3: Now, we will see below format dialog box. Go to “Custom” first.
- Step 4: Enter the format code “Week” # in the Type: area.
- Step 5: Press “OK.” We will have results ready.
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.
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?
- Step 1: Firstly, find the difference between the two dates.
- Step 2: Now, divide the difference by 7. We have 7 days a week.
- Step 3: Press the “Enter” key to complete the formula. We have a result like this.
- Step 4: Change the format to “General” for accurate results.
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.
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.
Now, divide the difference by 7. So we have 7 days a week.
We have a result like this.
Let us change the format of the resulting cell to fractions.
So, we have the number of weeks in fractions now.
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
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:
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.
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).
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:
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.
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.
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.
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.
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 –
- Month Function in excel
- Excel Formula for Weekday
- WEEKDAY Function Excel
- Insert Calendar In Excel
Purpose
Get the week number for a given date
Return value
A number between 1 and 54.
Usage notes
The WEEKNUM function takes a date and returns a number between 1 and 54 that corresponds to the week of the year. By default, the WEEKNUM function starts counting on the week that contains January 1 and increments week numbers on Sunday.
The WEEKNUM function accepts two arguments, serial_num and return_type. The serial_num argument must have a valid Excel date. The return_type argument controls what day of the week begins a new week number. Return_type is optional and defaults to 1, which sets new week numbers to start on Sunday. When return_type is set to 2, week numbers begin on Monday.
With a return_type of 1-17, week number 1 in a given year is assigned to the week that contains January 1. With return_type 21, week 1 is the week containing the first Thursday of the year, following ISO 8601. The table below summarizes return_type options.
Return_type | Week begins |
---|---|
1 (default) | Sunday |
2 | Monday |
11 | Monday |
12 | Tuesday |
13 | Wednesday |
14 | Thursday |
15 | Friday |
16 | Saturday |
17 | Sunday |
21 | Monday (see note above) |
Example #1 — basic usage
The formulas below return the week number for the last day of 2020 and the first day of 2021:
=WEEKNUM("31-Dec-2020") // returns 53
=WEEKNUM("1-Jan-2021") // returns 1
Example #2 — return type
The return_type argument controls what day of week begins a new week number. By default, return_type is 1, and numbers increment on Sunday. When return_type is provided as 2, week numbers begin on Monday. For example, January 3, 2021 is a Sunday and, WEEKNUM will return 2, since new numbers start on Sundays:
=WEEKNUM("3-Jan-2021") // returns 2
However, when return_type is set to 2, WEEKNUM will return 1 and start week 2 on Monday:
=WEEKNUM("3-Jan-2021",2) // returns 1
=WEEKNUM("4-Jan-2021",2) // returns 2
Note: the examples above show dates as text values for readability, but working native Excel dates is more reliable. To create a date from scratch in a formula, use the DATE function.
Содержание
- Week Number in Excel
- 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
- WEEKNUM Function
- Related functions
- Summary
- Purpose
- Return value
- Arguments
- Syntax
- Usage notes
- Example #1 — basic usage
- Example #2 — return type
- Get week number from date
- Related functions
- Summary
- Generic formula
- Explanation
- ISO week number
- Excel Week Numbers
- Week Numbers in Excel
- How to use Week Number (WEEKNUM) Function in Excel?
- Week Numbers in Excel – Example #1
- Week Numbers in Excel – Example #2
- Week Numbers in Excel – Example #3
- Things to Remember
- Recommended Articles
Week Number in Excel
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.
Table of contents
You are free to use this image on your website, templates, etc., Please provide us with an attribution link How to Provide Attribution? Article Link to be Hyperlinked
For eg:
Source: Week Number in Excel (wallstreetmojo.com)
Syntax
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?
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.
- Open the Excel WEEKNUM function in the B2 cell.
The serial_number is nothing but your date cell. So select A2 as the cell reference.
As of now, ignore the last argument. It will default consider Sunday as the starting day of the week.
Drag the formula to other cells.
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.
Now, let us change the start of the week to MONDAY.
You can mention the argument as 2. Close the formula.
The result is shown below:
Apply to other cells.
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.
- Step 1: Select all the result cells first.
- Step 2: Right-click on the selected cells and select “Format Cells.” You can directly press the shortcut key “Ctrl + 1.”
- Step 3: Now, we will see below format dialog box. Go to “Custom” first.
- Step 4: Enter the format code “Week” # in the Type: area.
- Step 5: Press “OK.” We will have results ready.
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.
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?
- Step 1: Firstly, find the difference between the two dates.
- Step 2: Now, divide the difference by 7. We have 7 days a week.
- Step 3: Press the “Enter” key to complete the formula. We have a result like this.
- Step 4: Change the format to “General” for accurate results.
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.
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.
Now, divide the difference by 7. So we have 7 days a week.
We have a result like this.
Let us change the format of the resulting cell to fractions.
So, we have the number of weeks in fractions now.
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: –
Источник
WEEKNUM Function
Summary
The Excel WEEKNUM function takes a date and returns a week number (1-54) that corresponds to the week of year. The WEEKNUM function starts counting on the week that contains January 1. By default, weeks begin on Sunday, but this can be changed.
Purpose
Return value
Arguments
- serial_num — A valid Excel date in serial number format.
- return_type — [optional] The day the week begins. Default is 1.
Syntax
Usage notes
The WEEKNUM function takes a date and returns a number between 1 and 54 that corresponds to the week of the year. By default, the WEEKNUM function starts counting on the week that contains January 1 and increments week numbers on Sunday.
The WEEKNUM function accepts two arguments, serial_num and return_type. The serial_num argument must have a valid Excel date. The return_type argument controls what day of the week begins a new week number. Return_type is optional and defaults to 1, which sets new week numbers to start on Sunday. When return_type is set to 2, week numbers begin on Monday.
With a return_type of 1-17, week number 1 in a given year is assigned to the week that contains January 1. With return_type 21, week 1 is the week containing the first Thursday of the year, following ISO 8601. The table below summarizes return_type options.
Return_type | Week begins |
---|---|
1 (default) | Sunday |
2 | Monday |
11 | Monday |
12 | Tuesday |
13 | Wednesday |
14 | Thursday |
15 | Friday |
16 | Saturday |
17 | Sunday |
21 | Monday (see note above) |
Example #1 — basic usage
The formulas below return the week number for the last day of 2020 and the first day of 2021:
Example #2 — return type
The return_type argument controls what day of week begins a new week number. By default, return_type is 1, and numbers increment on Sunday. When return_type is provided as 2, week numbers begin on Monday. For example, January 3, 2021 is a Sunday and, WEEKNUM will return 2, since new numbers start on Sundays:
However, when return_type is set to 2, WEEKNUM will return 1 and start week 2 on Monday:
Note: the examples above show dates as text values for readability, but working native Excel dates is more reliable. To create a date from scratch in a formula, use the DATE function.
Источник
Get week number from date
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:
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:
Starting in Excel 2013, there is a new function called ISOWEEKNUM.
Источник
Excel Week Numbers
Excel Week Numbers (Table of Contents)
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.
Excel functions, formula, charts, formatting creating excel dashboard & others
Syntax for WEEKNUM Function in;
The syntax for the excel WEEKNUM function, which outputs week number from a given date value, is as below:
- 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.
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 1 st, and the last week (i.e. week number 52) will be December 31 st .
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.
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 1 st and it’s a week from Sunday to Sunday (Though 1 st January 2017 was actually a Sunday, It becomes confusing when the 1 st day of the year does not fall on Sunday).
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:
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 1 st 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.
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.
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 1 st 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 2 nd 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.
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.
Suppose we have a date 1 st 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 2 nd January 2017 falls on Monday, ISOWEEKNUM gives week value as one.
Now suppose a date 1 st 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 1 st 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 –
Источник