WEEKNUM_EXCEL2003 Function (LibreOffice Calc)
LibreOffice WEEKNUM_EXCEL2003 examples show legacy Sunday/Monday week numbering, year boundaries and the renamed Excel-compatible entry.
Verification status: Official release source and independent examples for WEEKNUM_EXCEL2003 were reviewed. Imported formulas that mapped to other internal functions do not verify this compatibility entry; the guide preserves that limitation. How formula examples are checked
Quick answer: =WEEKNUM_EXCEL2003(DATE(1995;1;1);2) returns 1. This function uses a January-1 week-numbering system, not ISO week numbering.
Availability and version history
- Introduced: First calculation release not established. The 5.1 source-line rename changed WEEKNUM_ADD to this compatibility name.
- Supported in: LibreOffice 26.8.1.1. No final supported release has been established.
- Scope: Desktop Calc; compatibility function, retained rather than retired.
- Checked: October 14, 2026. Pinned source and independent examples checked. This compatibility name was not natively executed; tests of other imported names are separate.
Which week-numbering rule applies?
Week 1 contains January 1. Mode 1 starts subsequent weeks on Sunday; mode 2 starts them on Monday. Choosing Monday does not make the result ISO 8601: ISO week 1 contains January 4, which can assign dates at the beginning of January to the previous week-numbering year.
The official reference describes the convention. Current LibreOffice keeps this spelling for older Excel interoperability. For new workbooks, use WEEKNUM with the intended mode or ISOWEEKNUM for ISO weeks. This compatibility calculation was formerly called WEEKNUM_ADD.
Syntax and required arguments
=WEEKNUM_EXCEL2003(Date; ReturnType)
Both arguments are required in this documented form. Date should be a real spreadsheet date or a DATE expression. Use 1 for Sunday and 2 for Monday. The pinned add-in also takes its Monday branch for other integer modes, but those values are outside the documented 1/2 contract. Do not borrow modern WEEKNUM modes such as 21 for ISO numbering.
For a date in A2, enter =WEEKNUM_EXCEL2003(A2;2) in B2. Format B2 as an ordinary integer. A week number formatted as a date can appear to be a date in the spreadsheet epoch instead of the intended number.
Write DATE(2026;10;14), not 2026-10-14 without quotes: the latter is subtraction. DATE also avoids ambiguity between day/month and month/day text conventions. A time component does not define a fractional week number; normalize timestamps to the business date and timezone you intend before grouping records.
Reproducible year-boundary worksheet
Enter each DATE expression in column A. Put =WEEKNUM_EXCEL2003(A2;1) in B2 and =WEEKNUM_EXCEL2003(A2;2) in C2, then fill down. The expected integer results are independently derived from the two calendar rules.
| Date entered with DATE | Mode 1: Sunday | Mode 2: Monday |
|---|---|---|
DATE(1995;1;1) |
1 | 1 |
DATE(1995;1;2) |
1 | 2 |
DATE(2010;1;1) |
1 | 1 |
DATE(2010;1;7) |
2 | 2 |
DATE(2020;12;31) |
53 | 53 |
DATE(2021;1;1) |
1 | 1 |
DATE(2021;1;3) |
2 | 1 |
DATE(2021;1;4) |
2 | 2 |
DATE(2026;1;1) |
1 | 1 |
DATE(2026;10;14) |
42 | 42 |
Practical example: compare two calendar conventions
For 2021-01-01, both modes return 1 because it is January 1. On Sunday 2021-01-03, Sunday mode has advanced to week 2 while Monday mode is still week 1. On Monday 2021-01-04, both return 2. ISO week numbering instead regards 2021-01-01 as week 53 of 2020 and 2021-01-04 as week 1 of 2021.
When reconciling two reports, compare the underlying dates and rule before comparing week labels. A difference near New Year can be an intentional convention rather than bad date data. Test at least the last days of December and first days of January in every migration.
Advanced example: build a year-aware grouping key
A week number alone repeats every year. For calendar-year reporting under this January-1 system, keep =YEAR(A2) beside the week result. Filter or aggregate using both columns. Be explicit that weeks spanning January 1 are split by the calendar-year boundary; this is not the same as a continuous seven-day operational bucket.
Keep the date column as dates and the week column as numbers. A text label is useful for display but should not replace the data needed for chronological sorting. Sorting bare labels such as “week 10” and “week 2” alphabetically produces a different order from sorting numeric week values.
Errors and file compatibility
Blank cells, text dates, invalid argument types and extreme serial dates need separate handling in the actual workbook. The worksheet above uses explicit DATE expressions so those conversions are not hidden assumptions. If a result surprises you, inspect the stored date value and mode before changing the formula.
When a file format stores the calculation under WEEKNUM, the importing program decides how to map that name. A current application displaying a different native name may still be preserving the original calculation. Validate boundary cases after import rather than assuming text equality proves equivalent behavior.
The pinned evaluator supports the mode rules. These examples establish the calculation for the stated dates; they do not certify every locale, epoch setting or historical file-import path.