Function note

WEEKNUM with an invalid return_type can answer differently each time it is called

FUNC.WEEKNUM

FN-WEEKNUM-001: WEEKNUM with an invalid return_type can answer differently each time it is called

Quirk · measured · recorded 2026-11-04

The documentation says an out-of-range return_type gives #NUM!. Excel usually does, but not always, and the same call can give different answers. In recorded captures of build 20430, 479 (serial_number, return_type) pairs were read with different results: usually #NUM!, sometimes a number (0, 1, 9, 10, 53 or 54), and some pairs differ within one run file. In build 20527 a matrix of 1,926 pairs (serial_number 0, 1, 59, 60, 61 and 43831, return_type -32 to 288) was read twice in one request, and 623 pairs differed between the two readings: 619 between a number and #NUM!, and 4 between 9 and 10. Every difference has an undocumented return_type. The ten documented return_types (1, 2, 11 to 17 and 21) gave the same answer both times. No rule for the undocumented values is claimed.

Documentation: If Return_type is out of the range specified in the table above, a #NUM! error is returned. Source documentation

Call and input routeInputsExcelCorrect valueRecorded in
WEEKNUM(0, 23)
cell-value2
serial_number: 0
0x0000000000000000
return_type: 23
0x4037000000000000
#NUM!—Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
WEEKNUM(0, 23)
cell-value2
serial_number: 0
0x0000000000000000
return_type: 23
0x4037000000000000
1
0x3ff0000000000000
—Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
WEEKNUM(0, 33)
cell-value2
serial_number: 0
0x0000000000000000
return_type: 33
0x4040800000000000
0
0x0000000000000000
—Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
WEEKNUM(0, 33)
cell-value2
serial_number: 0
0x0000000000000000
return_type: 33
0x4040800000000000
#NUM!—Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture

Basis: The readings conflict with each other. The 479 comes from the DnaCalc witness differences file. The 1,926 pairs come from one request of 3,852 calls, with exact input read-backs, compared pair by pair.

Open: What decides the answer for an undocumented return_type is not known.

Open: The raw readings of build 20527 are not yet in a published capture. Their counts are recorded in the DnaCalc issue tracker.

Evidence and capture sources

Machine-readable note records