WEEKSINYEAR Function (OpenOffice Calc)
Return 52 or 53 with WEEKSINYEAR in Apache OpenOffice Calc. Understand the calendar-year input and ISO week-year boundary distinction.
Verification status: Eight ordinary reference formulas were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, through generated native ODF and GUI hard recalculation. Saved identities and results were checked. The registered ORG.OPENOFFICE storage name was used; English-name availability is source-checked. How formula examples are checked
Quick answer: =WEEKSINYEAR(DATE(2015;1;1)) returned 53 in the tested Apache OpenOffice 4.1.16 build.
Availability and version history
- Introduced: First release not established; documented by OpenOffice.org 3.3.
- Supported in: Apache OpenOffice 4.1.16; this is a verified release, not a final supported version.
- Scope: Desktop Calc, English function names and semicolon-separated formulas.
- Checked: October 14, 2026. Eight ordinary reference formulas were recalculated from generated ODF in 4.1.16 on Linux x86-64, Build 9816. Source and independent calendar arithmetic were checked.
What WEEKSINYEAR returns
WEEKSINYEAR returns 52 or 53 for the Gregorian calendar year extracted from Date, using the Monday-based ISO-style rule for how many numbered weeks that year has. It is neither the current week number nor the number of elapsed seven-day blocks in the year. Release implementation.
Syntax and arguments
WEEKSINYEAR(Date)
- Date: one required date serial or date cell. Use DATE(year;month;day), not a bare year number.
- The implementation extracts the calendar year and checks its January 1 weekday and leap status. It does not first replace the year with the ISO week-year of the supplied date.
Eight reproducible examples
The native column contains saved 4.1.16 results; independent references use exact date arithmetic or rational fractions. Numerical values are shown to twelve decimal places where needed. Enter the DATE expressions directly rather than substituting locale-dependent text.
The generated ODF uses ORG.OPENOFFICE.WEEKSINYEAR, mapped to the English worksheet name WEEKSINYEAR by the release function map. The saved operation was verified after recalculation. This establishes the ODF-format path rather than manual English-name entry.
| Formula | Native 4.1.16 result | Independent reference |
|---|---|---|
=WEEKSINYEAR(DATE(2015;1;1)) |
53 |
53 |
=WEEKSINYEAR(DATE(2016;1;1)) |
52 |
52 |
=WEEKSINYEAR(DATE(2020;6;1)) |
53 |
53 |
=WEEKSINYEAR(DATE(2021;1;1)) |
52 |
52 |
=WEEKSINYEAR(DATE(2024;12;31)) |
52 |
52 |
=WEEKSINYEAR(DATE(2026;1;1)) |
53 |
53 |
=WEEKSINYEAR(DATE(2004;12;31)) |
53 |
53 |
=WEEKSINYEAR(DATE(2000;1;1)) |
52 |
52 |
Practical worksheet
=WEEKSINYEAR(DATE(2020;6;1)) returns 53. The corresponding 2021 call returns 52. This can describe the number of week labels in a year-based planning calendar once that calendar’s week convention is chosen.
January 1, 2016 belongs to the last ISO week of 2015, but =WEEKSINYEAR(DATE(2016;1;1)) returns 52, because the function asks about calendar year 2016. Year 2015 itself has 53. Keep this distinction explicit when combining a date with an independently computed week-year label.
Advanced interpretation and checks
The source returns 53 when January 1 is Thursday, or when a leap year begins on Wednesday. All other years return 52. For example, 2015 and 2026 begin on Thursday; 2020 and 2004 are leap years beginning on Wednesday. All four are 53-week years under this rule.
An independent calendar check is the ISO week number of December 28, which always lies in the final ISO week of its calendar year. That cross-check agrees with all eight reference years. This does not make 365/7 or 366/7 an integer: complete week labels can include dates from an adjacent calendar year.
Boundaries and troubleshooting
For a year number in A2, use =WEEKSINYEAR(DATE(A2;1;1)). Passing 2020 directly treats it as a serial date. The function has no optional week-start or first-week argument; choose a different calculation if your organization uses a different week convention.
The source-mapped ODF add-in identity was used for the eight valid date examples. Manual English entry, other locales, text dates and invalid serials were not tested. Do not substitute this function for a weekly date-grouping or elapsed-duration formula.
Related functions
Official evidence and checking scope
The generated ODF produced the informational load warning “Not all attributes could be read.” The sheet was hard-recalculated and saved separately. All eight ordinary function identities and results were reconciled; a stale SUM cache changed from 999999 to 3 and an uncached SUM returned 7. This establishes the stated examples, not every workbook style or invalid input. Other explanatory identities are independent calculations. The authoring-tool XLSX was not executed in OpenOffice, and its preview values are not the native results reported here.