WEEKNUM (week number)

<< Click to Display Table of Contents >>

WEEKNUM (week number)

Syntax:

WEEKNUM(Date [, WeekStartsOn])

Description:

Returns the week number of a Date.

For this purpose, the calculation method commonly used in the USA and many other parts of the world is applied: The first calendar week of the year is always the week containing January 1st.

This method requires that the first calendar week cannot start in the previous year and in most cases does not include a full 7 days.

Note:

In Germany (and some other countries like Switzerland and Austria), a different method of calculation is normally used; here it is based on the ISO standard. See function ISOWEEKNUM (or see below WeekStartsOn with value variant "21").

Important:

Also note that by default, this function considers Sunday as the beginning of the week – not Monday.

However, you can change this with the optional argument WeekStartsOn. WeekStartsOn lets you specify on which day a week begins:

1 or omitted: Week begins on a Sunday.

2: Week begins on a Monday.

In addition, the following variants are also defined:

11: Week begins on a Monday.

12: Week begins on a Tuesday.

13: Week begins on a Wednesday.

14: Week begins on a Thursday.

15: Week begins on a Friday.

16: Week begins on a Saturday.

17: Week begins on a Sunday.

21: Week begins on a Monday. Here, the first calendar week of the year is the week that contains January 4th, in accordance with the ISO standard.

Compatibility notes:

Microsoft Excel supports the values 11-17 and 21 for the WeekStartsOn argument only in version 2010 or later. In older versions these values are not known.

Example:

On Sunday, the 5th of January, 2020:

WEEKNUM("01/05/2020", 1) returns 2

WEEKNUM("01/05/2020", 2) returns 1

See also:

ISOWEEKNUM, ISOWEEK, YEAR, MONTH, DAY, WEEKDAY