Contact

WEEKNUM_OOO Function (LibreOffice Calc)

Date & Time Beginner LibreOffice Calc

Use WEEKNUM_OOO in LibreOffice Calc for its older week-numbering rules, with Sunday/Monday choices, year-boundary examples and compatibility caveats.

Verification status: Twenty WEEKNUM_OOO formulas were recalculated through XLSX import in LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5. This is development-build evidence, not stable LibreOffice or Apache OpenOffice execution. How formula examples are checked

Quick answer: =WEEKNUM_OOO(DATE(1995;1;1);2) returns 52. This function uses the older Calc week-numbering system, whose first week contains January 4.

Availability and version history

  • Introduced: Available since LibreOffice 5.1, preserving older week-number behavior.
  • 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; supplementary execution used LibreOfficeDev 26.8 alpha through XLSX import, not the stable release.

Which week-numbering rule applies?

This is a compatibility function for LibreOffice before 5.1 and OpenOffice.org. It preserves the older rule instead of silently assigning a modern meaning to historical formulas. Mode 2 is Monday-based ISO 8601 numbering. Mode 1 starts weeks on Sunday while still using a four-day/January-4 first-week rule; that Sunday variant is not ISO 8601.

The official reference describes the convention. The function is intentionally hidden from the normal Function Wizard list to discourage accidental use. It remains supported and can occur in older documents. New workbooks should normally use WEEKNUM or ISOWEEKNUM with an explicit intended convention.

Syntax and required arguments

=WEEKNUM_OOO(Date; Mode)

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 source maps other mode values to its Monday rule, but explicit 1 or 2 makes the intended calendar clear.

For a date in A2, enter =WEEKNUM_OOO(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_OOO(A2;1) in B2 and =WEEKNUM_OOO(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 52
DATE(1995;1;2) 1 1
DATE(2010;1;1) 52 53
DATE(2010;1;7) 1 1
DATE(2020;12;31) 53 53
DATE(2021;1;1) 53 53
DATE(2021;1;3) 1 53
DATE(2021;1;4) 1 1
DATE(2026;1;1) 53 1
DATE(2026;10;14) 41 42

Practical example: compare two calendar conventions

For 1995-01-01, mode 1 returns 1 while mode 2 returns 52. That is not a one-week offset that can be corrected by adding or subtracting a constant. The Sunday-based week already belongs to the new week-year, while the ISO Monday week still belongs to 1994. The following day, 1995-01-02, both modes return 1.

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 is not unique across years. With Monday mode, use the ISO week-year rather than YEAR(date) at a boundary. For a valid date in A2, =YEAR(A2-WEEKDAY(A2;2)+4) obtains the year of that week’s Thursday. Combine that year with the week number only after confirming that mode 2 is your intended convention. This ISO helper must not be copied unchanged to the Sunday variant.

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.

The storage namespace is ORG.LIBREOFFICE.WEEKNUM_OOO. Earlier releases used transitional serialization, so a displayed name alone is not a complete interoperability test. Preserve a copy of the original file and compare results after a save/reopen round trip.

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.

The 20 date/mode table cases were also recalculated through XLSX import in LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5. The saved ODF formulas retained ORG.LIBREOFFICE.WEEKNUM_OOO. A deliberately stale result and an uncached formula confirmed that recalculation actually occurred; this does not certify the stable release.