MONTH Function (LibreOffice Calc)
The MONTH function extracts the month component (1–12) from a date or datetime value. It is essential for reporting, grouping, filtering, and constructing date logic.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the MONTH Function Does ▾
- Extracts the month from a date or datetime
- Accepts serial numbers, real dates, or converted text
- Returns an integer from 1 to 12
- Ignores year, day, and time components
It is designed to be simple, reliable, and ideal for date‑component extraction.
Syntax ▾
MONTH(date_value)
Arguments
- date_value:
A date, datetime, or serial number representing a date.
Basic Examples ▾
Extract month from a date
=MONTH("2024-03-15")
Returns 3.
Extract month from a datetime
=MONTH("2024-03-15 08:45")
Returns 3.
Extract month from a cell
=MONTH(A1)
Extract month from TODAY()
=MONTH(TODAY())
Advanced Examples ▾
Extract month from text using DATEVALUE
=MONTH(DATEVALUE(A1))
Extract month from imported CSV timestamps
=MONTH(DATEVALUE(LEFT(A1;10)))
Extract month from Excel serial dates imported as text
=MONTH(DATE(1899;12;30)+VALUE(A1))
Determine if two dates are in the same month
=MONTH(A1)=MONTH(B1)
Build a month label (e.g., “March”)
=TEXT(A1; "MMMM")
Build a short month label (e.g., “Mar”)
=TEXT(A1; "MMM")
Extract fiscal month (April–March example)
=MONTH(A1 - 90)
Extract month from YYYYMMDD text
=MONTH(DATEVALUE(LEFT(A1;4) & "-" & MID(A1;5;2) & "-" & RIGHT(A1;2)))
Extract month from DDMMYYYY text
=MONTH(DATEVALUE(RIGHT(A1;4) & "-" & MID(A1;3;2) & "-" & LEFT(A1;2)))
Edge Cases and Behavior Details ▾
MONTH returns an integer (1–12)
Accepts:
- Real dates
- Serial numbers
- DATEVALUE outputs
- ISO date strings
Invalid text → Err:502
MONTH ignores:
- Time components
- Timezones
- Seconds/milliseconds
- Everything after the date portion
MONTH of a number < 1 → Err:502
(Serial numbers must represent valid dates)
MONTH of an error → error propagates
Common Errors and Fixes ▾
Err:502 — Invalid argument
Cause:
- Text not recognized as a date
- Negative serial numbers
- Non-numeric values
Fix:
- Wrap with DATEVALUE
- Clean text with TRIM or SUBSTITUTE
Wrong month due to locale parsing
Fix:
- Convert to ISO format before DATEVALUE
MONTH returns unexpected value from serial numbers
Cause:
- Serial numbers represent days since epoch
Fix:
- Ensure imported values are converted properly
Best Practices ▾
- Use MONTH for grouping and reporting
- Normalize text dates with DATEVALUE
- Use MONTH with YEAR and DAY to reconstruct dates
- Use MONTH with TODAY() for dynamic calculations
- Use MONTH with EDATE/EOMONTH for period analysis
- Use TEXT(A1; “MMM”) or “MMMM” for readable labels
MONTH is your date‑extraction workhorse — perfect for reporting, grouping, filtering, and building dynamic date‑driven workflows.
Related Patterns and Alternatives ▾
- Use YEAR and DAY for other components
- Use DATE to construct dates
- Use DATEVALUE for text conversion
- Use NOW and TODAY for dynamic values
- Use EDATE and EOMONTH for month offsets
By mastering MONTH and its companion functions, you can build powerful, reliable, and fully structured date‑analysis workflows in LibreOffice Calc.