WEEKNUM Function in ONLYOFFICE: Syntax, Week-Date Examples and Troubleshooting
Compute week-of-year numbers and distinguish Sunday/Monday System 1 weeks from ISO System 2, with boundary calculations.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in ONLYOFFICE Spreadsheet Editor. How formula examples are checked
WEEKNUM in ONLYOFFICE Spreadsheet Editor
Quick answer
WEEKNUM returns a numeric week of the year, but its answer depends on which week-numbering system you choose. The official English syntax is =WEEKNUM(serial_number, [return_type]). Omitting the optional argument starts weeks on Sunday and defines week 1 as the week containing January 1. For an ISO-style week, use =WEEKNUM(A2,21) instead; the ISO week-year may differ from the calendar year. ONLYOFFICE WEEKNUM. This page’s example results are independently calculated predictions, not observed spreadsheet outputs.
Why week 1 needs a definition
The same date can be assigned different week numbers based on the first day of the week and the definition of the first week. Under System 1, the week containing January 1 is week 1. Under System 2 / ISO, the week containing the year’s first Thursday is week 1, and weeks begin on Monday. A report that groups dates by YEAR(date) plus the ISO week number can mislabel records around New Year; use the ISO week-year for ISO reporting.
Exact official syntax, parameters and return types
=WEEKNUM(serial_number, [return_type])
| Argument | Required? | Description | Default |
|---|---|---|---|
serial_number |
Yes | A valid spreadsheet date serial / date-producing function such as DATE |
No documented default |
return_type |
No | Numeric value defining week start and system | 1, Sunday-start System 1 |
The ONLYOFFICE reference documents the following types; no undocumented type is assumed valid:
return_type |
Week begins | Week 1 definition |
|---|---|---|
1 or omitted |
Sunday | System 1: includes January 1 |
2 or 11 |
Monday | System 1: includes January 1 |
12 |
Tuesday | System 1 |
13 |
Wednesday | System 1 |
14 |
Thursday | System 1 |
15 |
Friday | System 1 |
16 |
Saturday | System 1 |
17 |
Sunday | System 1 |
21 |
Monday | System 2: ISO first-Thursday rule |
The vendor reference describes 1–17 as System 1, but the actual enumerated values are the ones shown above; this is not permission to use integers such as 4 or 10. WEEKNUM(...,21) and ISOWEEKNUM(...) are distinct official functions that should normally agree for a valid date in the same tested build. Their agreement has not been natively verified here.
Reproducible practice sheet: boundary dates
Enter the 12 dates below in A2:A13 as DATE formulas rather than text. In B write the calendar weekday for inspection. In C2 enter =WEEKNUM(A2); in D2 enter =WEEKNUM(A2,2); in E2 enter =WEEKNUM(A2,21). Copy down. Expected values, independently calculated:
| Date in A | Calendar day (independent) | WEEKNUM(A,1) | WEEKNUM(A,2) | ISO week / WEEKNUM(A,21) |
|---|---|---|---|---|
| 2019-12-30 | Monday | 53 | 53 | 1 |
| 2020-01-01 | Wednesday | 1 | 1 | 1 |
| 2020-12-31 | Thursday | 53 | 53 | 53 |
| 2021-01-01 | Friday | 1 | 1 | 53 |
| 2021-01-03 | Sunday | 2 | 1 | 53 |
| 2021-01-04 | Monday | 2 | 2 | 1 |
| 2024-01-01 | Monday | 1 | 1 | 1 |
| 2024-12-29 | Sunday | 53 | 52 | 52 |
| 2024-12-30 | Monday | 53 | 53 | 1 |
| 2025-01-01 | Wednesday | 1 | 1 | 1 |
| 2026-01-01 | Thursday | 1 | 1 | 1 |
| 2026-10-11 | Sunday | 42 | 41 | 41 |
The first two result columns were calculated via both: (a) an independent January 1 / week-start offset model, and (b) Python %U (Sunday) / %W (Monday) numbering, adjusted for whether January 1 is itself the week-start day. Both methods matched on all fixture rows. The ISO column was checked with datetime.date.isocalendar().week. The CSV includes the ISO week-year, which may differ from the calendar year. No ONLYOFFICE formulas were executed.
Worked examples and practical applications
1. Default Sunday week. =WEEKNUM(DATE(2021,1,3)) predicts 2. January 1 is in week 1 even though it is Friday; Sunday, January 3 begins the next numbered week. =WEEKNUM(DATE(2021,1,1)) predicts 1.
2. Monday-start week, still System 1. =WEEKNUM(DATE(2021,1,3),2) predicts 1, while =WEEKNUM(DATE(2021,1,4),2) predicts 2. A Monday start is not by itself ISO week numbering.
3. ISO week at a year boundary. =WEEKNUM(DATE(2021,1,1),21) predicts 53 because January 1, 2021 belongs to ISO week 53 of 2020. In contrast, =WEEKNUM(DATE(2021,1,1)) predicts 1. Use the ISO week-year in annual reports.
4. A date in an ISO week from the following year. =WEEKNUM(DATE(2024,12,30),21) predicts 1 (ISO week-year 2025). The same date with default type 1 predicts 53. Never combine ISO week 1 with unqualified calendar year 2024 without stating the reporting convention.
5. Generate a stable sortable week key. If A2 contains a valid date, the ISO year can be independently reasoned about using the Thursday of that ISO week. A candidate workbook key is:
=YEAR(A2-WEEKDAY(A2,2)+4)*100+WEEKNUM(A2,21)
For A2 = 2021-01-01, independently expected 202053. For 2024-12-30, expected 202501. This is a compound formula involving documented YEAR and WEEKDAY functions; native interaction has not been tested. It assumes date arithmetic behaves as documented for the target workbook’s date system.
6. Alternative week starts. For a Saturday-start System 1 schedule, use =WEEKNUM(A2,16). The ONLYOFFICE reference documents 16 as Saturday. Changing the start day will change boundary dates, not the calendar date itself. The separate fixture provides expected Sunday/Monday/ISO comparison values; other types require explicit native regression tests.
Troubleshooting and limitations
| Issue | Cause / test |
|---|---|
| Monday-first and ISO produce different years or week numbers | Type 2 is System 1; type 21 is System 2. Check the first-Thursday rule. |
| Week 1 appears in late December | That can occur under ISO System 2; use the ISO week-year, not the calendar year. |
| Date strings import incorrectly | Use =DATE(yyyy,m,d) to remove locale ambiguity; compare actual dates, not display text. |
| Error with a return type | Only the numeric types listed by the official ONLYOFFICE documentation are established; check the build. |
| Different results between books | Check if either workbook uses the 1904 date system or different date parsing. |
| A 53/1 boundary seems impossible | ISO reporting years can begin before Jan 1, and end after Dec 31. Check year and week. |
The vendor article does not specify EXACT error codes for invalid dates, unsupported values, fractional return types, or negative serials. Microsoft Excel discusses certain #NUM! cases, but it would be misleading to claim the same errors were observed in ONLYOFFICE.
Portability and versions
Microsoft Excel’s WEEKNUM reference documents the same main type map, including type 21, but testing on one application does not establish ONLYOFFICE’s version-by-version fidelity, mobile support, date-serial boundaries or localization. Google Sheets and other spreadsheet engines are not independently tested in this batch. Store the week system, return type and ISO week-year alongside exported reports, especially in CSV exports where formulas and types may be lost.
Product scope, regional settings and test status
These examples use the English, unversioned ONLYOFFICE Spreadsheet Editor help as accessed October 11, 2026. That establishes documented function names and parameters, but does not establish a minimum supported Docs web edition, a minimum Desktop Editors build, or mobile editor parity. There is no running ONLYOFFICE editor in this research environment. None of the results on this page was observed in ONLYOFFICE. The tables are independently calculated predictions for someone to reproduce and verify in a real build.
- Docs / web: the vendor documents this function in its general Spreadsheet Editor reference, but this batch did not test a particular server version, integration or browser.
- Desktop: Desktop Editors have a separate release history and were not executed. Do not describe the results as Desktop-tested.
- Mobile / older releases: support and recalculation behaviour are not established by the undated help page. Check the function picker on the exact target build.
- Formula names and arguments: in the English reference, formulas use English names, commas to separate arguments, and parentheses. Advanced Settings has a Formula Language option; verify localized names and separators before copying examples into another locale. The comma notation is only guaranteed as the documented English form, not as universal pasted syntax.
- Date presentation: enter dates with
=DATE(year,month,day)or explicit typed date cells. Region can affect displayed date order and interpretation of pasted date text. Avoid"01/02/2026"as an ambiguous text date. The vendor also documents an optional 1904 date system, so do not mix serial-number literals between imported workbooks without checking the date system. - Recalculation: if recalculation is unexpected, check the application’s calculation and workbook settings; no recalculation performance was tested.
Sources: ONLYOFFICE Insert Functions, ONLYOFFICE Advanced Settings.
Verified related documentation
- ONLYOFFICE WEEKDAY — weekday numbers, not week-of-year numbers.
- ONLYOFFICE ISOWEEKNUM — single-argument ISO week number.
- ONLYOFFICE DATE — reproducible, locale-unambiguous input.
Sources accessed: ONLYOFFICE WEEKNUM, ONLYOFFICE Insert Functions, ONLYOFFICE Advanced Settings, Excel WEEKNUM — 2026-10-11. Validation: documentation and two independent Python week-index models, no native ONLYOFFICE execution.
Official reference and verification
- ONLYOFFICE Spreadsheet Editor — function documentation
- ONLYOFFICE Insert Functions
- ONLYOFFICE Advanced Settings
- ONLYOFFICE WEEKDAY
- ONLYOFFICE ISOWEEKNUM
- ONLYOFFICE DATE
Verification status: Official documentation checked; example outcomes were independently reasoned or arithmetically checked where applicable. Not executed in ONLYOFFICE Spreadsheet Editor.
- No genuine ONLYOFFICE Spreadsheet Editor screenshots are included; this guide does not use mock application images.