Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Using the WEEKNUM Function.

Using the WEEKNUM Function

by Allen Wyatt
(last updated December 6, 2016)

4

One of the handy date and time functions provided by Excel is WEEKNUM. This function is used, oddly enough, to return the week number represented by a particular date. You use the function in this way:

=WEEKNUM(A5,1)

In this instance, A5 contains a date serial number, and the value 1 indicates that WEEKNUM should assume that all weeks start on a Sunday. If you prefer your weeks to begin on Mondays, then you can use the value 2 instead.

You should realize that WEEKNUM always considers the first day of any given year to be in the first week of the year. Thus, it is possible for the above formula to return up to 54 weeks in a year. How can this be? Let's use the year 2011 as an example. In 2011 January 1 falls on a Saturday. As far as WEEKNUM is concerned, this is in the first week of the year. Now, January 2 for that year falls on a Sunday. Since WEEKNUM believes that every Sunday starts a new week, the second day of the week is considered in the second week of the year.

This is fine, until you get to the end of the year. The fifty-second week of 2011 ends (according to WEEKNUM) on December 24, and the fifty-third week begins on December 25 (a Sunday).

An even more interesting scenario is when the year begins on a Saturday and the year is a leap year. This happened in the year 2000. In that instance, the fifty-third week began on December 24, and the fifty-fourth week began on December 31.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7804) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Using the WEEKNUM Function.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Setting a Spacing Adjustment in the Equation Editor

The Equation Editor is a handy tool when you are creating documents that rely on mathematical formulas. If you want to adjust ...

Discover More

Changing How Word Presents Your Document

Tired of the old black-on-white text displayed by Word? Depending on your program version, you can configure Word to show ...

Discover More

Hiding Errors

If you find the green and red squiggly underlines that Word adds to your document distracting, you might want a quick way to ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Finding the Date Associated with a Negative Value

When working with data taken from the real world, you often have to determine which certain conditions were met, such as when ...

Discover More

Phantom Counts

Two common worksheet functions used to count things are COUNT and COUNTA. Not understanding how these functions treat cell ...

Discover More

Displaying Letter Grades

Grading in schools is often done using numeric values. However, you may want to change those numeric values into letter ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 3?

2016-12-24 11:06:05

Doug Frith

As part of my annual professional registration, I also need to report on the number of weeks in which I provided care. weeknum tells me the week number, but can I count the number of weeks? Some weeks I may work 4 or 5 shifts, but others only 1 or 2 or even none at all.
Thanks!


2016-12-07 09:31:08

John

Oops, please ignore my comment below about beginning on January 1.

The suggestion does not work and was based on an incorrect assumption about the nature of the second argument. My apologies.


2016-12-07 03:49:57

Tony Nixon

I think it is worth noting that the WEEKNUM function also copes with the ISO week number definition "commonly known as the European week numbering system" according to Microsoft!
In this system "The week containing the first Thursday of the year is the first week of the year, and is numbered as week 1". In the ISO system weeks _always_ begin on a Monday and to use it, in place of 1 or 2 as quoted in Allen's formula, you substitute 21


2016-12-06 22:06:58

John

If you prefer your weeks to begin on the first day of the year (January 1), then you can use the value =WEEKDAY(DATEVALUE("1/1/"&YEAR(A1))) to obtain the second argument, assuming the date in question is stored in cell A1.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.