The Problem
You have dates in column A (like 1/15/2025) and need to extract just the year, month, or day. You want to group data by year, filter by month, or analyze by day of month.
The Easy Way: Use SheetXAI
If you don't want to mess with formulas, the fastest way to do this is simply by asking.
With SheetXAI, you can open the sidebar and type:
Extract the year, month, and day from the date in A2.
SheetXAI will instantly write the formula or script for you and fill the cells. It handles the syntax so you can focus on the result.
The Manual Way: The Formulas You Need
To do this manually, you need to use: YEAR, MONTH, or DAY.
1. YEAR
Returns the year from a date as a number (e.g., 2025). Extracts the year component from a date.
Syntax: =YEAR(serial_number)
- serial_number: The date you want to extract the year from.
Example: YEAR(1/15/2025) returns 2025.
2. MONTH
Returns the month from a date as a number from 1 to 12. Extracts the month component from a date.
Syntax: =MONTH(serial_number)
- serial_number: The date you want to extract the month from.
Example: MONTH(1/15/2025) returns 1 (January).
3. DAY
Returns the day of the month from a date as a number from 1 to 31. Extracts the day component from a date.
Syntax: =DAY(serial_number)
- serial_number: The date you want to extract the day from.
Example: DAY(1/15/2025) returns 15.
Understanding the Logic
- YEAR: Extracts the year (4-digit number like 2025).
- MONTH: Extracts the month (1-12, where 1=January, 12=December).
- DAY: Extracts the day of the month (1-31).
Key points:
- All three functions take a date as input and return a number
- Often used together: YEAR(A2), MONTH(A2), DAY(A2)
- Useful for grouping, filtering, and analyzing dates
- Can be combined with other date functions
Common use cases:
- YEAR: Group sales by year, calculate years of service
- MONTH: Filter by month, create monthly reports, seasonal analysis
- DAY: Analyze by day of month, find specific dates
The Final Formula:
=YEAR(A2)
Conclusion
Now you know the "classic" way to solve this using formulas. It's a great skill to have.
But for those times when you just want the job done without the mental math, SheetXAI is there to help.
Related Guides
- TODAY and NOW in Google Sheets - Get current date and time
- DATE Function in Google Sheets - Construct dates from components
- How to Calculate Days Between Dates in Google Sheets - Date calculations
- Google Sheets AI Guide - Learn how AI can automate your Google Sheets workflows
- AI Spreadsheet Tools - Discover how AI transforms spreadsheet work