How to get the year, month, or day from a date
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Split a date into its parts — for grouping by year, filtering by month, or rebuilding dates.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =YEAR(A2) | MONTH(A2) gives 1-12, DAY(A2) gives 1-31. DATE(y,m,d) reassembles them. |
| Google Sheets | =YEAR(A2) | Identical. |
| LibreOffice Calc | =YEAR(A2) | Identical. |
How it works
YEAR, MONTH, and DAY each return a plain number from a date (the verification packs all three into 20260723 to prove each one). They're the building blocks for grouping (sum by year), conditions (MONTH(A2)=7), and date surgery — e.g. "same day next year" is DATE(YEAR(A2)+1,MONTH(A2),DAY(A2)). If they return #VALUE!, your "date" is text — convert it first (see the convert-text-to-date recipe).
Verified, not just documented
We ran =YEAR(DATE(2026,7,23))*10000+MONTH(DATE(2026,7,23))*100+DAY(DATE(2026,7,23)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 20260723 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 20260723 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
YEAR — see full Excel, Google Sheets & LibreOffice compatibility for each.