WEEKDAY Function (LibreOffice Calc)
The WEEKDAY function returns the day of the week for a given date, using one of several numbering systems. It is essential for scheduling, calendars, dashboards, and weekday-based logic.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the WEEKDAY Function Does ▾
- Returns the day of the week as a number
- Supports multiple numbering systems
- Works with real dates, serial numbers, and DATEVALUE
- Ignores time components
It is designed to be flexible, locale‑aware, and ideal for weekday logic.
Syntax ▾
WEEKDAY(date; [mode])
Arguments
-
date:
A valid date or serial number. -
mode (optional):
Determines the numbering system.
Numbering Systems ▾
| Mode | Meaning | Week Starts On | Returns |
|---|---|---|---|
| 1 (default) | Sunday = 1 | Sunday | 1–7 |
| 2 | Monday = 1 | Monday | 1–7 |
| 3 | Monday = 0 | Monday | 0–6 |
Notes:
- Mode 2 is the most common for business logic.
- Mode 3 is ideal for zero‑based indexing.
Basic Examples ▾
Default behavior (Sunday = 1)
=WEEKDAY("2024-03-15")
Monday = 1
=WEEKDAY("2024-03-15"; 2)
Monday = 0 (zero‑based)
=WEEKDAY("2024-03-15"; 3)
Using a cell reference
=WEEKDAY(A1)
Weekday of today
=WEEKDAY(TODAY(); 2)
Advanced Examples ▾
Convert weekday number to name
=TEXT(A1; "NNNN")
Check if a date is a weekend (Mode 2)
=WEEKDAY(A1;2)>5
Check if a date is a weekday
=WEEKDAY(A1;2)<=5
Get next Monday
=A1 + MOD(1 - WEEKDAY(A1;2); 7)
Get previous Monday
=A1 - MOD(WEEKDAY(A1;2)-1; 7)
Get next business day
=A1 + IF(WEEKDAY(A1;2)>=5; 8-WEEKDAY(A1;2); 1)
Extract weekday from text using DATEVALUE
=WEEKDAY(DATEVALUE(A1); 2)
Extract weekday from imported CSV timestamp
=WEEKDAY(DATEVALUE(LEFT(A1;10)); 2)
Extract weekday from Excel serial date stored as text
=WEEKDAY(DATE(1899;12;30)+VALUE(A1); 2)
Build a weekday label (e.g., “Mon”)
=TEXT(A1; "NNN")
Build a full weekday label (e.g., “Monday”)
=TEXT(A1; "NNNN")
Edge Cases and Behavior Details ▾
WEEKDAY returns an integer (0–7 depending on mode)
Accepts:
- Real dates
- Serial numbers
- DATEVALUE outputs
- ISO date strings
Invalid text → Err:502
Time components are ignored
WEEKDAY may differ from ISOWEEKNUM
WEEKDAY of an error → error propagates
Zero‑based mode (3) is useful for indexing arrays
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 weekday due to mode confusion
Fix:
- Use mode 2 for Monday‑start logic
- Use mode 3 for zero‑based indexing
Wrong result due to text dates
Fix:
- Normalize with DATEVALUE
Best Practices ▾
- Use mode 2 (Monday = 1) for business logic
- Use mode 3 (Monday = 0) for indexing
- Normalize text dates with DATEVALUE
- Use WEEKDAY with TEXT() to build labels
- Use WEEKDAY for scheduling, calendars, and dashboards
WEEKDAY is your weekday‑logic engine — perfect for scheduling, dashboards, business rules, and calendar workflows.
Related Patterns and Alternatives ▾
- Use ISOWEEKNUM for ISO‑8601 week numbering
- Use WEEKNUM for locale‑specific week numbering
- Use DATE for constructing comparison dates
- Use DATEDIF and DAYS for interval calculations
By mastering WEEKDAY and its companion functions, you can build powerful, flexible, and fully dynamic weekday‑based workflows in LibreOffice Calc.