Formualizer Docs

WEEKDAY

Returns the day-of-week index for a date serial with configurable numbering.

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

=WEEKDAY(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 (Sunday=1 through Saturday=7).
  • Input serials are interpreted with the workbook's date system (Excel 1900 or Excel 1904). Because the epochs are 1462 days apart (1462 % 7 == 6), the same serial denotes a different weekday in each system.

Error cases

  • Supported return_type values are 1, 2, 3, 11-17; unsupported values return #NUM!.

Examples

Find the day number using the default Sunday-first convention.

Formula =WEEKDAY(DATE(2024,1,1))

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?.

Switch to Monday-first numbering.

Formula =WEEKDAY(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?.

Sunday is the final day under Monday-first numbering.

Formula =WEEKDAY(DATE(2024,1,7),2)

Expected result 7

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?.

Return type 99 is outside the supported numbering codes.

Formula =WEEKDAY(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 numbering (Sunday-first)

Formula =WEEKDAY(45292)

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?.

Monday-first numbering

Formula =WEEKDAY(45292, 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?.

FAQ

Why do I get #NUM! for some return_type values?

WEEKDAY only accepts specific Excel return_type codes (1, 2, 3, 11-17); other codes return #NUM!.

Implementation

Engine source

On this page