Formualizer Docs

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

ArgumentTypeRequiredDefault
serial_numbernumberRequired—
return_typenumberOptional—

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_type is 1 (week starts on Sunday).
  • Supported return_type values are 1, 2, 11-17, and 21 (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_type values 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?.

FAQ

What is special about return_type 21 in WEEKNUM?

return_type=21 switches to ISO week numbering, matching ISOWEEKNUM behavior.

Implementation

Engine source

On this page