WEEKNUM
Returns the week number of the year for a date serial.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=WEEKNUM(serial_number, [return_type])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
serial_number | number | Required | — |
return_type | number | Optional | — |
Remarks
- A date argument may be text holding a date or time (
"10/26/1999","1999-10-26 14:05"), read as its serial; text that is neither a number nor a date returns#VALUE!. - Default
return_typeis1(week starts on Sunday). - Supported
return_typevalues are1,2,11-17, and21(ISO week numbering). - Input serials are interpreted using the workbook's date system (Excel 1900 or Excel 1904); week boundaries differ between the systems because their epochs are 1462 days apart.
Error cases
- Unsupported
return_typevalues return#NUM!.
Examples
The first Sunday starts week two with the default Sunday start.
Formula =WEEKNUM(DATE(2024,1,7))
Expected result 2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
With Monday starts, the same Sunday is still in week one.
Formula =WEEKNUM(DATE(2024,1,7),2)
Expected result 1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
January 1 belongs to the first week in this numbering mode.
Formula =WEEKNUM(DATE(2024,1,1),2)
Expected result 1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
An unsupported return type cannot define a week numbering rule.
Formula =WEEKNUM(DATE(2024,1,1),99)
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Default week numbering
Formula =WEEKNUM(45292)
Expected result 1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
ISO week numbering
Formula =WEEKNUM(42370, 21)
Expected result 53
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What is special about return_type 21 in WEEKNUM?
return_type=21 switches to ISO week numbering, matching ISOWEEKNUM behavior.