WEEKNUM Function (LibreOffice Calc)
The WEEKNUM function returns the week number of a given date, using either system 1 (week starts on Sunday) or system 2 (week starts on Monday). It is ideal for locale-specific week numbering.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the WEEKNUM Function Does ▾
- Returns the week number (1–53)
- Supports two numbering systems
- Allows Sunday‑start or Monday‑start weeks
- Works with real dates, serial numbers, and DATEVALUE
It is designed to be flexible, regional, and business‑friendly.
Syntax ▾
WEEKNUM(date; [mode])
Arguments
-
date:
A valid date or serial number. -
mode (optional):
Determines the week numbering system.
Numbering Systems ▾
| Mode | Meaning | Week Starts On |
|---|---|---|
| 1 (default) | System 1 | Sunday |
| 2 | System 2 | Monday |
Important:
These are not ISO‑8601 rules. For ISO weeks, use ISOWEEKNUM.
Basic Examples ▾
Default behavior (System 1, Sunday start)
=WEEKNUM("2024-01-01")
Monday‑start week numbering
=WEEKNUM("2024-01-01"; 2)
Using a cell reference
=WEEKNUM(A1)
Week number of today
=WEEKNUM(TODAY())
Advanced Examples ▾
Week number from text using DATEVALUE
=WEEKNUM(DATEVALUE(A1))
Week number from imported CSV timestamp
=WEEKNUM(DATEVALUE(LEFT(A1;10)))
Week number from Excel serial date stored as text
=WEEKNUM(DATE(1899;12;30)+VALUE(A1))
Determine if two dates fall in the same week (System 2)
=WEEKNUM(A1;2)=WEEKNUM(B1;2)
Build a week label (e.g., “Week 05”)
="Week " & TEXT(WEEKNUM(A1;2);"00")
First day of the week (System 2)
=A1 - WEEKDAY(A1;2) + 1
Last day of the week (System 2)
=A1 - WEEKDAY(A1;2) + 7
Convert WEEKNUM to ISO week (approximation)
=ISOWEEKNUM(A1)
Determine the week’s year (System 2)
=YEAR(A1 - WEEKDAY(A1;2) + 1)
Differences Between WEEKNUM and ISOWEEKNUM ▾
| Feature | WEEKNUM | ISOWEEKNUM |
|---|---|---|
| Week starts | Sunday (1) or Monday (2) | Always Monday |
| Week 1 definition | Locale/business rules | Week with first Thursday |
| ISO‑compliant | No | Yes |
| Use case | Regional calendars | International standards |
Edge Cases and Behavior Details ▾
WEEKNUM returns an integer (1–53)
Accepts:
- Real dates
- Serial numbers
- DATEVALUE outputs
- ISO date strings
Invalid text → Err:502
Time components are ignored
WEEKNUM may produce different results depending on mode
WEEKNUM may differ from ISOWEEKNUM
WEEKNUM of an error → error propagates
Common Errors and Fixes ▾
Err:502 — Invalid argument
Cause:
- Text not recognized as a date
- Non-numeric values
Fix:
- Wrap with DATEVALUE
- Clean text with TRIM or SUBSTITUTE
Wrong week due to mode confusion
Fix:
- Use mode 2 for Monday‑start weeks
- Use ISOWEEKNUM for ISO‑compliant numbering
Unexpected week at year boundaries
Cause:
- WEEKNUM does not follow ISO rules
Fix:
- Use ISOWEEKNUM if ISO behavior is required
Best Practices ▾
- Use WEEKNUM for regional or business calendars
- Use ISOWEEKNUM for international reporting
- Normalize text dates with DATEVALUE
- Always specify mode explicitly for clarity
- Use WEEKNUM with TEXT() to build week labels
WEEKNUM is your flexible, locale‑aware week‑numbering tool — perfect for business calendars, dashboards, and regional reporting.
Related Patterns and Alternatives ▾
- Use ISOWEEKNUM for ISO‑8601 week numbering
- Use WEEKDAY for day‑of‑week logic
- Use DATE for constructing comparison dates
- Use DATEDIF and DAYS for interval calculations
By mastering WEEKNUM and its companion functions, you can build powerful, flexible, and region‑aware date workflows in LibreOffice Calc.